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


PHP Connection::setFetchMode方法代碼示例

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


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

示例1: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return \Illuminate\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // The database connection can also utilize a cache manager instance when cache
     // functionality is used on queries, which provides an expressive interface
     // to caching both fluent queries and Eloquent queries that are executed.
     $app = $this->app;
     $connection->setCacheManager(function () use($app) {
         return $app['cache'];
     });
     // We will setup a Closure to resolve the paginator instance on the connection
     // since the Paginator isn't used on every request and needs quite a few of
     // our dependencies. It'll be more efficient to lazily resolve instances.
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     // Here we'll set a reconnector callback. This reconnector can be any callable
     // so we will set a Closure to reconnect from this manager with the name of
     // the connection, which will allow us to reconnect from the connections.
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
開發者ID:noikiy,項目名稱:laravel-UI,代碼行數:33,代碼來源:DatabaseManager.php

示例2: findMask

 /**
  * {@inheritdoc}
  */
 public function findMask(RequesterInterface $requester, ResourceInterface $resource)
 {
     $oldFetchMode = $this->connection->getFetchMode();
     $this->connection->setFetchMode(\PDO::FETCH_COLUMN);
     if (null === ($mask = $this->connection->selectOne('SELECT mask FROM ' . $this->getAclSchema()->getPermissionsTableName() . ' WHERE requester = :requester AND resource = :resource', ['requester' => $requester->getAclRequesterIdentifier(), 'resource' => $resource->getAclResourceIdentifier()]))) {
         $this->connection->setFetchMode($oldFetchMode);
         throw new MaskNotFoundException();
     }
     $this->connection->setFetchMode($oldFetchMode);
     return (int) $mask;
 }
開發者ID:alexdpy,項目名稱:acl,代碼行數:14,代碼來源:IlluminateDatabaseProvider.php

示例3: setFetchMode

 /**
  * Set the default fetch mode for the connection.
  * 
  * NOTE! Crate cannot use PDO::FETCH_CLASS fetch mode, so
  * 	we silently  change it to PDO::FETCH_ASSOC
  *
  * @param  int  $fetchMode
  * @return int
  */
 public function setFetchMode($fetchMode)
 {
     if ($fetchMode === \PDO::FETCH_CLASS) {
         $fetchMode = \PDO::FETCH_ASSOC;
     }
     parent::setFetchMode($fetchMode);
 }
開發者ID:ChaosPower,項目名稱:laravel-crate.io,代碼行數:16,代碼來源:Connection.php

示例4: setFetchMode

 /**
  * Set the default fetch mode for the connection.
  *
  * NOTE! Crate cannot use PDO::FETCH_CLASS fetch mode, so
  * 	we silently  change it to PDO::FETCH_ASSOC
  * 	https://crate.io/docs/reference/pdo/usage.html#fetch-modes
  *
  * @param  int  $fetchMode
  * @return int
  */
 public function setFetchMode($fetchMode, $fetchArgument = null, array $ctorArgs = [])
 {
     if ($fetchMode !== \PDO::FETCH_ASSOC) {
         $fetchMode = \PDO::FETCH_ASSOC;
     }
     parent::setFetchMode($fetchMode, $fetchArgument, $ctorArgs);
 }
開發者ID:ratkor,項目名稱:laravel-crate.io,代碼行數:17,代碼來源:Connection.php

示例5: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  Illuminate\Database\Connection  $connection
  * @return Illuminate\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     $connection->setEventDispatcher($this->app['events']);
     // We will setup a Closure to resolve the paginator instance on the connection
     // since the Paginator isn't sued on every request and needs quite a few of
     // our dependencies. It'll be more efficient to lazily resolve instances.
     $app = $this->app;
     $connection->setPaginator(function () use($app) {
         return $app['paginator'];
     });
     return $connection;
 }
開發者ID:hochanh,項目名稱:Bootsoft-Bowling,代碼行數:19,代碼來源:DatabaseManager.php

示例6: prepare

 /**
  * Prepare the database connection instance.
  *
  * @param  \Illuminate\Database\Connection  $connection
  * @return \Illuminate\Database\Connection
  */
 protected function prepare(Connection $connection)
 {
     $connection->setFetchMode($this->app['config']['database.fetch']);
     if ($this->app->bound('events')) {
         $connection->setEventDispatcher($this->app['events']);
     }
     // Here we'll set a reconnector callback. This reconnector can be any callable
     // so we will set a Closure to reconnect from this manager with the name of
     // the connection, which will allow us to reconnect from the connections.
     $connection->setReconnector(function ($connection) {
         $this->reconnect($connection->getName());
     });
     return $connection;
 }
開發者ID:hilmysyarif,項目名稱:sisfito,代碼行數:20,代碼來源:DatabaseManager.php

示例7: getPhotos

 /**
  * {@inheritDoc}
  */
 public function getPhotos(array $photoIds)
 {
     $this->connection->setFetchMode(\PDO::FETCH_ASSOC);
     return $this->connection->table($this->options['photo_table'])->whereIn('id', $photoIds)->get();
 }
開發者ID:morrelinko,項目名稱:laravel-simple-photo,代碼行數:8,代碼來源:LaravelDataStore.php


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