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