繁体   English   中英

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

[英]SetIntegrityCheck from DB Adapter in Zend

嗨,我想在zend db select中使用join。 我知道setintegritycheck()在联接中很重要。 当我有一个模型对象时,我知道如何实现它

$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');

但就我而言,我不是模特。 dbadapter 现在我这样写我的查询

    $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');

线

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

返回项目数据库的适配器,我已经确认了。 现在在这种情况下,我的选择对象来自数据库适配器,因此当我尝试获取setintegritycheck它将生成错误

Unrecognized method 'setIntegrityCheck()' 

我可以告诉我如何在这种情况下进行完整性检查。

setIntegrityCheck()Zend_Db_Table_Select的方法。 如果要从数据库适配器构建选择,则使用的是Zend_Db_Select ,并且没有完整性检查,因此您不必担心禁用它。

完整性检查会检查查询返回的列是否匹配表上的列,因此仅在Zend_Db_Table上下文中才有意义。

暂无
暂无

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

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