當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。