當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Db_Select::setIntegrityCheck方法代碼示例

本文整理匯總了PHP中Zend_Db_Select::setIntegrityCheck方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Db_Select::setIntegrityCheck方法的具體用法?PHP Zend_Db_Select::setIntegrityCheck怎麽用?PHP Zend_Db_Select::setIntegrityCheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Db_Select的用法示例。


在下文中一共展示了Zend_Db_Select::setIntegrityCheck方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _applySelect

 protected function _applySelect(Zend_Db_Select $dbSelect, Kwf_Model_Select $select)
 {
     if ($dbSelect instanceof Zend_Db_Table_Select) {
         $dbSelect->setIntegrityCheck(false);
     }
     if ($whereEquals = $select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
         foreach ($whereEquals as $field => $value) {
             if (is_array($value)) {
                 if ($value) {
                     foreach ($value as &$v) {
                         if (!is_int($v)) {
                             $v = $this->_fixStupidQuoteBug($v);
                             $v = $this->getAdapter()->quote($v);
                         }
                     }
                     $value = implode(', ', $value);
                     $dbSelect->where($this->_formatField($field, $dbSelect) . " IN ({$value})");
                 } else {
                     $dbSelect->where('0');
                 }
             } else {
                 $value = $this->_fixStupidQuoteBug($value);
                 $dbSelect->where($this->_formatField($field, $dbSelect) . " = ?", $value);
             }
         }
     }
     if ($whereNotEquals = $select->getPart(Kwf_Model_Select::WHERE_NOT_EQUALS)) {
         foreach ($whereNotEquals as $field => $value) {
             if (is_array($value)) {
                 foreach ($value as &$v) {
                     if (!is_int($v)) {
                         $v = $this->_fixStupidQuoteBug($v);
                         $v = $this->getAdapter()->quote($v);
                     }
                 }
                 $value = implode(', ', $value);
                 $dbSelect->where($this->_formatField($field, $dbSelect) . " NOT IN ({$value})");
             } else {
                 $value = $this->_fixStupidQuoteBug($value);
                 $dbSelect->where($this->_formatField($field, $dbSelect) . " != ?", $value);
             }
         }
     }
     if ($this->_hasDeletedFlag && !$select->getPart(Kwf_Model_Select::IGNORE_DELETED)) {
         $dbSelect->where("deleted = 0");
     }
     if ($where = $select->getPart(Kwf_Model_Select::WHERE)) {
         foreach ($where as $w) {
             $dbSelect->where($w[0], $w[1], $w[2]);
         }
     }
     if ($whereId = $select->getPart(Kwf_Model_Select::WHERE_ID)) {
         $whereId = $this->_fixStupidQuoteBug($whereId);
         $dbSelect->where($this->_formatField($this->getPrimaryKey(), $dbSelect) . " = ?", $whereId);
     }
     if ($whereNull = $select->getPart(Kwf_Model_Select::WHERE_NULL)) {
         foreach ($whereNull as $field) {
             $dbSelect->where("ISNULL(" . $this->_formatField($field, $dbSelect) . ")");
         }
     }
     if ($other = $select->getPart(Kwf_Model_Select::OTHER)) {
         foreach ($other as $i) {
             call_user_func_array(array($dbSelect, $i['method']), $i['arguments']);
         }
     }
     if ($whereExpression = $select->getPart(Kwf_Model_Select::WHERE_EXPRESSION)) {
         foreach ($whereExpression as $expr) {
             $expr->validate();
             $dbSelect->where($this->_createDbSelectExpression($expr, $dbSelect));
         }
     }
     if ($exprs = $select->getPart(Kwf_Model_Select::EXPR)) {
         foreach ($exprs as $field) {
             if (!($col = $this->_formatField($field, $dbSelect))) {
                 throw new Kwf_Exception("Expression '{$field}' not found");
             }
             $dbSelect->from(null, array($field => new Zend_Db_Expr($col)));
         }
     }
 }
開發者ID:nsams,項目名稱:koala-framework,代碼行數:80,代碼來源:Db.php


注:本文中的Zend_Db_Select::setIntegrityCheck方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。