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


PHP Builder::toSql方法代碼示例

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


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

示例1: getItems

 public function getItems($limit, $offset)
 {
     $builder = $this->query->getQuery();
     if ($builder->groups || $builder->unions) {
         $row = DB::selectOne("SELECT COUNT(*) qty FROM (" . $this->query->toSql() . ") sub", $this->query->getBindings());
         $total = (int) $row->qty;
     } else {
         $total = $this->query->count();
     }
     $pageOfItems = $this->query->skip($offset)->take($limit)->get();
     return [$pageOfItems, $total];
 }
開發者ID:phonedotcom,項目名稱:mason-laravel,代碼行數:12,代碼來源:EloquentContainer.php

示例2: toSql

 public function toSql()
 {
     $this->newQuery();
     return $this->query->toSql();
 }
開發者ID:sthWrong,項目名稱:season5.co,代碼行數:5,代碼來源:AbstractRepository.php

示例3: getQueryPreview

 /**
  * Get a preview of what query will be run from a query builder.
  *
  * This DOES NOT run the query so it can be used for debugging potentially memory-intensive queries.
  *
  * @param QueryBuilder $query
  * @return string
  */
 public static function getQueryPreview(QueryBuilder $query = null)
 {
     if (empty($query)) {
         return "";
     }
     $sql = str_replace('?', "'%s'", $query->toSql());
     $bindings = $query->getBindings();
     return vsprintf($sql, $bindings);
 }
開發者ID:werx,項目名稱:core,代碼行數:17,代碼來源:Database.php

示例4: mergeQueries

 /**
  * Merge our cloned query builder with the original one.
  *
  * @param \Illuminate\Database\Eloquent\Builder $clone
  * @param \Illuminate\Database\Eloquent\Builder $original
  */
 protected function mergeQueries(Builder $clone, Builder $original)
 {
     $original->from(DB::connection($this->connection)->raw("({$clone->toSql()}) as `{$this->getTable()}`"));
     $original->mergeBindings($clone->getQuery());
 }
開發者ID:singgihsap,項目名稱:elearning,代碼行數:11,代碼來源:SearchableTrait.php

示例5: mergeQueries

 /**
  * Merge our cloned query builder with the original one.
  *
  * @param \Illuminate\Database\Eloquent\Builder $clone
  * @param \Illuminate\Database\Eloquent\Builder $original
  */
 protected function mergeQueries(Builder $clone, Builder $original)
 {
     if ($this->getDatabaseDriver() == 'pgsql') {
         $original->from(DB::connection($this->connection)->raw("({$clone->toSql()}) as {$this->getTable()}"));
     } else {
         $original->from(DB::connection($this->connection)->raw("({$clone->toSql()}) as `{$this->getTable()}`"));
     }
     $original->mergeBindings($clone->getQuery());
 }
開發者ID:Rahul-Giri,項目名稱:searchable,代碼行數:15,代碼來源:SearchableTrait.php

示例6: mergeQueries

 /**
  * Merge our cloned query builder with the original one.
  *
  * @param \Illuminate\Database\Eloquent\Builder $clone
  * @param \Illuminate\Database\Eloquent\Builder $original
  */
 protected function mergeQueries(Builder $clone, Builder $original)
 {
     $prefix = App::$Database->connection($this->connection)->getTablePrefix();
     $tableName = $prefix . $this->getTable();
     if ($this->getDatabaseDriver() == 'pgsql') {
         $original->from(App::$Database->connection($this->connection)->raw("({$clone->toSql()}) as {$tableName}"));
     } else {
         $original->from(App::$Database->connection($this->connection)->raw("({$clone->toSql()}) as `{$tableName}`"));
     }
     $original->mergeBindings($clone->getQuery());
 }
開發者ID:phpffcms,項目名稱:searchable,代碼行數:17,代碼來源:SearchableTrait.php

示例7: debug

 public function debug()
 {
     dd($this->query->toSql());
 }
開發者ID:gdgfoz,項目名稱:codelab-todo-api,代碼行數:4,代碼來源:BaseRepository.php

示例8: generateCacheKey

 /**
  * Generate a cache key
  *
  * @return string
  */
 public function generateCacheKey()
 {
     return md5($this->model->getConnectionName() . $this->builder->toSql() . serialize($this->builder->getBindings()));
 }
開發者ID:renatogcarvalho,項目名稱:feeder,代碼行數:9,代碼來源:Repository.php

示例9: toSql

 /**
  * Get the SQL representation of the Filterer query.
  *
  * @return string
  */
 public function toSql()
 {
     return $this->builder->toSql();
 }
開發者ID:adrianyg7,項目名稱:Filterer,代碼行數:9,代碼來源:Filterer.php


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