当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::getConfig方法代码示例

本文整理汇总了PHP中Illuminate\Database\Connection::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getConfig方法的具体用法?PHP Connection::getConfig怎么用?PHP Connection::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Connection的用法示例。


在下文中一共展示了Connection::getConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compileCreateEncoding

 /**
  * Append the character set specifications to a command.
  *
  * @param  string  $sql
  * @param  \Illuminate\Database\Connection  $connection
  * @return string
  */
 protected function compileCreateEncoding($sql, Connection $connection)
 {
     if (!is_null($charset = $connection->getConfig('charset'))) {
         $sql .= ' default character set ' . $charset;
     }
     if (!is_null($collation = $connection->getConfig('collation'))) {
         $sql .= ' collate ' . $collation;
     }
     return $sql;
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:17,代码来源:MySqlGrammar.php

示例2: compileCreateEncoding

 /**
  * Append the character set specifications to a command.
  *
  * @param  string  $sql
  * @param  \Illuminate\Database\Connection  $connection
  * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
  * @return string
  */
 protected function compileCreateEncoding($sql, Connection $connection, Blueprint $blueprint)
 {
     if (isset($blueprint->charset)) {
         $sql .= ' default character set ' . $blueprint->charset;
     } elseif (!is_null($charset = $connection->getConfig('charset'))) {
         $sql .= ' default character set ' . $charset;
     }
     if (isset($blueprint->collation)) {
         $sql .= ' collate ' . $blueprint->collation;
     } elseif (!is_null($collation = $connection->getConfig('collation'))) {
         $sql .= ' collate ' . $collation;
     }
     return $sql;
 }
开发者ID:janhartigan,项目名称:framework,代码行数:22,代码来源:MySqlGrammar.php

示例3: getLegacyConnection

 /**
  * @param \Illuminate\Database\Connection $eloquentConnection
  *
  * @return \DreamFactory\Core\Database\Connection
  * @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
  */
 public static function getLegacyConnection($eloquentConnection)
 {
     if (empty(static::$connection)) {
         $driver = $eloquentConnection->getDriverName();
         if (empty($driver)) {
             throw new InternalServerErrorException('No database driver supplied');
         }
         $connections = config('database.connections');
         if (empty($connections)) {
             throw new InternalServerErrorException('No connections found in database.connections config');
         }
         $configKeys = [];
         foreach ($connections as $name => $connectionConfig) {
             if ($driver === $name || $driver === $connectionConfig['driver'] || $driver === 'dblib' && $name === 'sqlsrv') {
                 $configKeys = array_keys($connectionConfig);
             }
         }
         if (empty($configKeys)) {
             throw new InternalServerErrorException('Unsupported driver - ' . $driver);
         }
         $config = [];
         foreach ($configKeys as $key) {
             $config[$key] = $eloquentConnection->getConfig($key);
         }
         switch ($driver) {
             case 'sqlite':
                 $dsn = $driver . ":" . $config['database'];
                 break;
             case 'mysql':
                 $dsn = static::getMySqlDsn($config);
                 break;
             case 'pgsql':
                 $dsn = static::getPgSqlDsn($config);
                 break;
             case 'sqlsrv':
             case 'dblib':
                 $dsn = static::getSqlSrvDsn($config);
                 break;
             default:
                 throw new InternalServerErrorException('Unsupported driver - ' . $driver);
                 break;
         }
         $config['dsn'] = $dsn;
         static::$connection = ConnectionFactory::createConnection($driver, $config);
     }
     return static::$connection;
 }
开发者ID:df-arif,项目名称:df-core,代码行数:53,代码来源:ConnectionAdapter.php

示例4: isSqlite

 /**
  * Return whether or not the current database driver is SQLite.
  *
  * Useful for avoiding running queries that are not compatible with SQLite.
  *
  * @return bool
  */
 protected function isSqlite()
 {
     return $this->db->getConfig('driver') == 'sqlite';
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:11,代码来源:BaseMigration.php


注:本文中的Illuminate\Database\Connection::getConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。