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


PHP Connection::getDsn方法代碼示例

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


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

示例1: __construct

 /**
  * Create autodiscovery structure.
  */
 public function __construct(Nette\Database\Connection $connection, Nette\Caching\IStorage $cacheStorage = NULL)
 {
     $this->connection = $connection;
     if ($cacheStorage) {
         $this->cache = new Nette\Caching\Cache($cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
         $this->structure = $this->loadedStructure = $this->cache->load('structure') ?: array();
     }
 }
開發者ID:cujan,項目名稱:atlashornin,代碼行數:11,代碼來源:DiscoveredReflection.php

示例2: setConnection

 public function setConnection(Nette\Database\Connection $connection)
 {
     $this->connection = $connection;
     if ($this->cacheStorage) {
         $this->cache = new Nette\Caching\Cache($this->cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
         $this->structure = $this->cache->load('structure') ?: $this->structure;
     }
 }
開發者ID:BroukPytlik,項目名稱:agility,代碼行數:8,代碼來源:DiscoveredReflection.php

示例3: __construct

 /**
  * Create autodiscovery structure.
  */
 public function __construct(Nette\Database\Connection $connection, Nette\Caching\IStorage $cacheStorage = NULL)
 {
     trigger_error(__CLASS__ . '() is deprecated; use Nette\\Database\\Conventions\\DiscoveredConventions instead.', E_USER_DEPRECATED);
     $this->connection = $connection;
     if ($cacheStorage) {
         $this->cache = new Nette\Caching\Cache($cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
         $this->structure = $this->loadedStructure = $this->cache->load('structure') ?: array();
     }
 }
開發者ID:jave007,項目名稱:test,代碼行數:12,代碼來源:DiscoveredReflection.php

示例4: __construct

 /**
  * Creates filtered table representation.
  * @param  Nette\Database\Connection
  * @param  string  database table name
  */
 public function __construct(Nette\Database\Connection $connection, $table, Nette\Database\IReflection $reflection, Nette\Caching\IStorage $cacheStorage = NULL)
 {
     $this->name = $table;
     $this->connection = $connection;
     $this->reflection = $reflection;
     $this->cache = $cacheStorage ? new Nette\Caching\Cache($cacheStorage, 'Nette.Database.' . md5($connection->getDsn())) : NULL;
     $this->primary = $reflection->getPrimary($table);
     $this->sqlBuilder = new SqlBuilder($table, $connection, $reflection);
     $this->refCache =& $this->getRefTable($refPath)->globalRefCache[$refPath];
 }
開發者ID:jurasm2,項目名稱:nette,代碼行數:15,代碼來源:Selection.php

示例5: __construct

 public function __construct($sqlDir, $sqlExt, $dbUpdateTable, $definerUser, $definerHost, Database\Connection $dbConnection, Database\IStructure $structure)
 {
     $this->sqlDir = $sqlDir . DIRECTORY_SEPARATOR;
     $this->sqlExt = $sqlExt;
     $this->dbUpdateTable = $dbUpdateTable;
     $this->db = new Database\Context($dbConnection, $structure);
     $this->dbName = $this->getDbNameFromDsn($dbConnection->getDsn());
     $this->definerUser = $definerUser;
     $this->definerHost = $definerHost;
 }
開發者ID:meridius,項目名稱:yadup,代碼行數:10,代碼來源:UpdatorService.php

示例6: __testbench_ndb_connectToDatabase

 /** @internal */
 private function __testbench_ndb_connectToDatabase(Connection $db, $databaseName = NULL)
 {
     //connect to an existing database other than $this->_databaseName
     $container = $this->__testbench_ndb_getContainer();
     if ($databaseName === NULL) {
         $config = $container->parameters['testbench'];
         if (isset($config['dbname'])) {
             $databaseName = $config['dbname'];
         } elseif ($db->getSupplementalDriver() instanceof PgSqlDriver) {
             $databaseName = 'postgres';
         } else {
             throw new \LogicException('You should setup existing database name using testbench:dbname option.');
         }
     }
     $dsn = preg_replace('~dbname=[a-z0-9_-]+~i', "dbname={$databaseName}", $db->getDsn());
     $dbr = $db->getReflection();
     //:-(
     $params = $dbr->getProperty('params');
     $params->setAccessible(TRUE);
     $params = $params->getValue($db);
     $options = $dbr->getProperty('options');
     $options->setAccessible(TRUE);
     $options = $options->getValue($db);
     $db->disconnect();
     $db->__construct($dsn, $params[1], $params[2], $options);
     $db->connect();
 }
開發者ID:jakubskrz,項目名稱:testbench,代碼行數:28,代碼來源:TNetteDatabase.php

示例7: __construct

 public function __construct(Connection $connection, Nette\Caching\IStorage $cacheStorage)
 {
     $this->connection = $connection;
     $this->cache = new Nette\Caching\Cache($cacheStorage, 'Nette.Database.Structure.' . md5($this->connection->getDsn()));
 }
開發者ID:NetteCamp,項目名稱:2015-nextras-orm-twitter,代碼行數:5,代碼來源:Structure.php

示例8: getDsnKey

 /** @return string */
 private function getDsnKey()
 {
     return sha1($this->connection->getDsn());
 }
開發者ID:uestla,項目名稱:easyblog,代碼行數:5,代碼來源:Transaction.php

示例9: setConnection

 function setConnection(Nette\Database\Connection $connection)
 {
     $this->connection = $connection;
     if ($this->cacheStorage) {
         $this->cache = new Nette\Caching\Cache($this->cacheStorage, 'Nette.Database.Discovery/' . $connection->getDsn());
         $this->structure = $this->cache->load('structure');
     }
 }
開發者ID:skapytek,項目名稱:scripts,代碼行數:8,代碼來源:nette.min.php


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