From c60d50216a9b4440a99719604577727bf380199a Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 15 Jan 2007 18:54:21 +0000 Subject: [PATCH] PDO-style data source names supported for Doctrine_Db --- lib/Doctrine/Db.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Db.php b/lib/Doctrine/Db.php index d93270fb7..7d1929fc2 100644 --- a/lib/Doctrine/Db.php +++ b/lib/Doctrine/Db.php @@ -105,6 +105,15 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte $a = self::parseDSN($dsn); 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['username'] = $user; @@ -235,7 +244,7 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte * @param string $dsn * @return array Parsed contents of DSN */ - function parseDSN($dsn) + public function parseDSN($dsn) { // silence any warnings $parts = @parse_url($dsn);