简体   繁体   English

从Zend中的数据库适配器进行SetIntegrityCheck

[英]SetIntegrityCheck from DB Adapter in Zend

Hi there I want to use join in zend db select. 嗨,我想在zend db select中使用join。 I know that setintegritycheck() is importants in joins. 我知道setintegritycheck()在联接中很重要。 I know how to implement it when I am having a model object like 当我有一个模型对象时,我知道如何实现它

$select = $this->select();
$select->setintegritycheck(false);
$select->from(array('info'),array())
            ->join(array('cfields'),'info.class=cfields.class_id',array('field_id','type_id'))
            ->where('info.id=2');

But In my case I am not in model. 但就我而言,我不是模特。 I am having dbadapter . dbadapter Now I am writing my query like this 现在我这样写我的查询

    $dbAdapter = MyManager::getDbAdapator('project');
    $select = $dbAdapter->select('info');

    $select->setIntegrityCheck(false);
    $select->from(array('info'),array())
            ->join(array('cfields'),'info.class=cfields.class_id',array('field_id','type_id'))
            ->where('info.id=2');

The line 线

$dbAdapter = MyManager::getDbAdapator('project');

returns the adapter of project database, I have cerfied it. 返回项目数据库的适配器,我已经确认了。 Now in this case my select object is from db adapter so when I try to get setintegritycheck it generates error 现在在这种情况下,我的选择对象来自数据库适配器,因此当我尝试获取setintegritycheck它将生成错误

Unrecognized method 'setIntegrityCheck()' 

Can I any body tell me how can I put integritycheck in this case. 我可以告诉我如何在这种情况下进行完整性检查。

setIntegrityCheck() is a method on Zend_Db_Table_Select . setIntegrityCheck()Zend_Db_Table_Select的方法。 If you are building a select from a DB adapter, you're using Zend_Db_Select instead, and there is no integrity check, so you don't need to worry about disabling it. 如果要从数据库适配器构建选择,则使用的是Zend_Db_Select ,并且没有完整性检查,因此您不必担心禁用它。

The integrity check checks that columns returned by the query match columns on the table, so it only makes sense in the context of Zend_Db_Table . 完整性检查会检查查询返回的列是否匹配表上的列,因此仅在Zend_Db_Table上下文中才有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM