当前位置: 首页>>代码示例>>PHP>>正文


PHP Query::prepareBuild方法代码示例

本文整理汇总了PHP中yii\db\Query::prepareBuild方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::prepareBuild方法的具体用法?PHP Query::prepareBuild怎么用?PHP Query::prepareBuild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\db\Query的用法示例。


在下文中一共展示了Query::prepareBuild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 /**
  * Generates a SELECT SQL statement from a [[Query]] object.
  * @param Query $query the [[Query]] object from which the SQL statement will be generated.
  * @param array $params the parameters to be bound to the generated SQL statement. These parameters will
  * be included in the result with the additional parameters generated during the query building process.
  * @return array the generated SQL statement (the first array element) and the corresponding
  * parameters to be bound to the SQL statement (the second array element). The parameters returned
  * include those provided in `$params`.
  */
 public function build($query, $params = [])
 {
     $query->prepareBuild($this);
     $params = empty($params) ? $query->params : array_merge($params, $query->params);
     $clauses = [$this->buildSelect($query->select, $params, $query->distinct, $query->selectOption), $this->buildFrom($query->from, $params), $this->buildJoin($query->join, $params), $this->buildWhere($query->where, $params), $this->buildGroupBy($query->groupBy), $this->buildHaving($query->having, $params), $this->buildOrderBy($query->orderBy), $this->buildLimit($query->limit, $query->offset)];
     $sql = implode($this->separator, array_filter($clauses));
     $union = $this->buildUnion($query->union, $params);
     if ($union !== '') {
         $sql = "({$sql}){$this->separator}{$union}";
     }
     return [$sql, $params];
 }
开发者ID:bmsrox,项目名称:yiicomm,代码行数:21,代码来源:QueryBuilder.php


注:本文中的yii\db\Query::prepareBuild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。