Commit c60d5021 authored by zYne's avatar zYne

PDO-style data source names supported for Doctrine_Db

parent 7131ab9e
...@@ -105,6 +105,15 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte ...@@ -105,6 +105,15 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
$a = self::parseDSN($dsn); $a = self::parseDSN($dsn);
extract($a); extract($a);
} else {
$e = explode(':', $dsn);
if($e[0] == 'uri') {
$e[0] = 'odbc';
}
$this->pendingAttributes[PDO::ATTR_DRIVER_NAME] = $e[0];
} }
$this->options['dsn'] = $dsn; $this->options['dsn'] = $dsn;
$this->options['username'] = $user; $this->options['username'] = $user;
...@@ -235,7 +244,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte ...@@ -235,7 +244,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
* @param string $dsn * @param string $dsn
* @return array Parsed contents of DSN * @return array Parsed contents of DSN
*/ */
function parseDSN($dsn) public function parseDSN($dsn)
{ {
// silence any warnings // silence any warnings
$parts = @parse_url($dsn); $parts = @parse_url($dsn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment