当前位置: 首页>>代码示例>>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;未经允许,请勿转载。