當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。