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


PHP Connection::select方法代碼示例

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


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

示例1: runSelect

 /**
  * Run the query as a "select" statement against the connection.
  *
  * @return array
  */
 protected function runSelect()
 {
     if ($this->useWritePdo) {
         return $this->connection->select($this->toSql(), $this->getBindings(), false);
     }
     return $this->connection->select($this->toSql(), $this->getBindings());
 }
開發者ID:fparralejo,項目名稱:btrabajo,代碼行數:12,代碼來源:Builder.php

示例2: _explainAndShowIndex

 private function _explainAndShowIndex(Connection $connection, $sql, $bindings)
 {
     $explainResults = $connection->select('explain ' . $sql, $bindings);
     foreach ($explainResults as $explainResult) {
         $results = get_object_vars($explainResult);
         $results['sql'] = $sql;
         $this->explainResults[] = $results;
         if (empty($results['table'])) {
             continue;
         }
         $showIndexResults = $connection->select('show index from ' . $results['table']);
         foreach ($showIndexResults as $showIndexResult) {
             $this->showIndexResults[] = get_object_vars($showIndexResult);
         }
     }
 }
開發者ID:htatemi,項目名稱:laravel-sql-alert,代碼行數:16,代碼來源:QueryAnalyzer.php

示例3: processInsertGetIdForOdbc

 /**
  * Process an "insert get ID" query for ODBC.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return int
  */
 protected function processInsertGetIdForOdbc($connection)
 {
     $result = $connection->select('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid');
     if (!$result) {
         throw new Exception('Unable to retrieve lastInsertID for ODBC.');
     }
     return $result[0]->insertid;
 }
開發者ID:imydou,項目名稱:dkuu,代碼行數:14,代碼來源:SqlServerProcessor.php

示例4: getTableColumns

 private function getTableColumns($callback = null)
 {
     if ($this->tableColumns === null) {
         $this->tableColumns = $this->db->select('SHOW COLUMNS FROM ' . $this->table);
     }
     $filteredColumns = $callback ? array_filter($this->tableColumns, $callback) : $this->tableColumns;
     return array_pluck($filteredColumns, 'Field');
 }
開發者ID:joegreen0991,項目名稱:scaffold,代碼行數:8,代碼來源:Scaffold.php

示例5: exists

 /**
  * Determine if any rows exist for the current query.
  *
  * @return bool
  */
 public function exists()
 {
     $sql = $this->grammar->compileExists($this);
     $results = $this->connection->select($sql, $this->getBindings(), !$this->useWritePdo);
     if (isset($results[0])) {
         $results = (array) $results[0];
         return (bool) $results['exists'];
     }
 }
開發者ID:nickaggarwal,項目名稱:framework,代碼行數:14,代碼來源:Builder.php

示例6: get

 /**
  * Execute the query as a "select" statement.
  *
  * @param  array  $columns
  * @return array
  */
 public function get($columns = array('*'))
 {
     // If no columns have been specified for the select statement, we will set them
     // here to either the passed columns, or the standard default of retrieving
     // all of the columns on the table using the "wildcard" column character.
     if (is_null($this->columns)) {
         $this->columns = $columns;
     }
     $results = $this->connection->select($this->toSql(), $this->bindings);
     $this->processor->processSelect($this, $results);
     return $results;
 }
開發者ID:brucewu16899,項目名稱:laravel-admin-panel,代碼行數:18,代碼來源:Builder.php

示例7: runSelect

 /**
  * Run the query as a "select" statement against the connection.
  *
  * @return array
  */
 protected function runSelect()
 {
     return $this->connection->select($this->toSql(), $this->getBindings());
 }
開發者ID:devonzara,項目名稱:framework,代碼行數:9,代碼來源:Builder.php

示例8: getColumnListing

 /**
  * Get the column listing for a given table.
  *
  * @param  string  $table
  * @return array
  */
 public function getColumnListing($table)
 {
     $table = $this->connection->getTablePrefix() . $table;
     $results = $this->connection->select($this->grammar->compileColumnExists($table));
     return $this->connection->getPostProcessor()->processColumnListing($results);
 }
開發者ID:davidhemphill,項目名稱:framework,代碼行數:12,代碼來源:Builder.php

示例9: select

 /**
  * Run a select statement against the database.
  *
  * @param  string  $query
  * @param  array   $bindings
  * @return \Stidges\LaravelDbNormalizer\Collection
  */
 public function select($query, $bindings = array())
 {
     $records = parent::select($query, $bindings);
     return $this->getNormalizer()->normalize($records);
 }
開發者ID:dhaval48,項目名稱:laravel-db-normalizer,代碼行數:12,代碼來源:Connection.php

示例10: hasTable

 /**
  * Determine if the given table exists.
  *
  * @param  string  $table
  * @return bool
  */
 public function hasTable($table)
 {
     $sql = $this->grammar->compileTableExists();
     $table = $this->connection->getTablePrefix() . $table;
     return count($this->connection->select($sql, array($table))) > 0;
 }
開發者ID:defra91,項目名稱:levecchiecredenze.it,代碼行數:12,代碼來源:Builder.php


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