getDsn() 공개 메소드

public getDsn ( ) : string
리턴 string
예제 #1
0
 /**
  * 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();
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 /**
  * 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();
     }
 }
예제 #4
0
파일: Selection.php 프로젝트: jurasm2/nette
 /**
  * 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];
 }
예제 #5
0
 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;
 }
예제 #6
0
 /** @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();
 }
 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()));
 }
예제 #8
0
 /** @return string */
 private function getDsnKey()
 {
     return sha1($this->connection->getDsn());
 }
예제 #9
0
 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');
     }
 }