/** * @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']); }
/** * 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; }
/** * 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); }