简体   繁体   中英

SetIntegrityCheck from DB Adapter in Zend

Hi there I want to use join in zend db select. I know that setintegritycheck() is importants in joins. 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 . 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

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 . 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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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