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


PHP Q::arAnd_block方法代碼示例

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


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

示例1: find

 /**
  * 検索を実行する
  *
  * @return StatementIterator
  */
 public final function find()
 {
     $this->verify_class_access("call C(DAO_CLASS)->find()");
     $args = func_get_args();
     $query = new Q();
     call_user_func_array(array($query, "add"), $args);
     if (!$query->isOrder_by()) {
         foreach ($this->primary_columns() as $column) {
             $query->order($column->name());
         }
     }
     $paginator = $query->paginator();
     if ($paginator instanceof Paginator) {
         $paginator->total(call_user_func_array(array($this, "find_count"), $query->arAnd_block()));
     }
     $sql = $this->call_module("select_sql", $this, $query, $paginator);
     $statement = $this->prepare($sql->sql);
     $statement->execute($sql->vars);
     $errors = $statement->errorInfo();
     if (sizeof($errors) == 3) {
         throw new LogicException("[" . $errors[1] . "] " . $errors[2]);
     }
     return new StatementIterator($this, $statement);
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:29,代碼來源:Dao.php

示例2: where_sql

 protected function where_sql(Dao $dao, Q $q, array $self_columns, $require_where = null)
 {
     if ($q->isBlock()) {
         $vars = $and = array();
         foreach ($q->arAnd_block() as $qa) {
             list($where, $var) = $this->where_sql($dao, $qa, $self_columns);
             if (!empty($where)) {
                 $and[] = $where;
                 $vars = array_merge($vars, $var);
             }
         }
         $where_sql = empty($and) ? "" : "(" . implode(" and ", $and) . ") ";
         foreach ($q->arOr_block() as $or_block) {
             foreach ($or_block as $qa) {
                 list($where, $var) = $this->where_sql($dao, $qa, $self_columns);
                 if (!empty($where)) {
                     $where_sql .= " or (" . $where . ") ";
                     $vars = array_merge($vars, $var);
                 }
             }
         }
         if (empty($where_sql)) {
             $where_sql = $require_where;
         } else {
             if (!empty($require_where)) {
                 $where_sql = "(" . $require_where . ") and (" . $where_sql . ")";
             }
         }
         return array($where_sql, $vars);
     }
     if ($q->type() == Q::MATCH) {
         return $this->where_sql($dao, $this->where_match($q, $self_columns), $self_columns);
     }
     return $this->where_cond($dao, $q, $self_columns);
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:35,代碼來源:DbController.php


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