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