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