簡體   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