예제 #1
0
 /**
  * @dataProvider dsnProvider
  */
 public function testDecode($driver, $host, $port, $user, $pass, $database, $dsn)
 {
     $decoded = DSN::decode($dsn);
     $this->assertSame($driver, $decoded['driver']);
     $this->assertSame($host, $decoded['host']);
     $this->assertSame($port, $decoded['port']);
     $this->assertSame($user, $decoded['user']);
     $this->assertSame($pass, $decoded['pass']);
     $this->assertSame($database, $decoded['database']);
 }
예제 #2
0
파일: DB.php 프로젝트: thornberger/empire
 /**
  * Constructs an new <code>DB</code> from a DSN string.
  *
  * @param string $dsn the dsn string
  * @see empire\framework\db\DSN
  */
 public static function constructFromDSN($dsn, $prefix = '')
 {
     $decoded = DSN::decode($dsn);
     $db = new DB(new DBConnection($decoded['driver'], $decoded['host'], $decoded['port'], $decoded['database'], $decoded['user'], $decoded['pass'], array(), $prefix));
     return $db;
 }
예제 #3
0
 /**
  * Returns a DSN string from this connection.
  *
  * @return string the DSN string
  */
 public function getDSN()
 {
     return DSN::encode($this->driver, $this->host, $this->port, $this->user, $this->pass, $this->id);
 }