1
0
mirror of synced 2025-01-18 14:31:40 +03:00

ok, fixing last fix

after my last commit i did some research in the php/pdo documentation and found that the port (well even the dsn) syntax depends a lot on the driver.
so my last 'fix' did fix it for mysql -  but broke it for dblib/mssql, this patch should make it work with those aswell (just moved jonwages solution to a own case for dblib & mssql driver). Someone should check if it works with the other drivers (i dont have all those database systems) cause looking at the doc
did show some more diffrences. (PHP Documentation for example says the dsn for pgsql needs to be delimited by spaces instead of semi-colons)
This commit is contained in:
ppetermann 2007-10-12 13:18:40 +00:00
parent 2621996cb2
commit 37d7707f57

View File

@ -336,13 +336,34 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
break;
case 'mssql':
case 'dblib':
if ( ! isset($parts['path']) || $parts['path'] == '/') {
throw new Doctrine_Manager_Exception('No database available in data source name');
}
if (isset($parts['path'])) {
$parts['database'] = substr($parts['path'], 1);
}
if ( ! isset($parts['host'])) {
throw new Doctrine_Manager_Exception('No hostname set in data source name');
}
if (isset(self::$driverMap[$parts['scheme']])) {
$parts['scheme'] = self::$driverMap[$parts['scheme']];
}
$parts['dsn'] = $parts['scheme'] . ':host='
. $parts['host'] . (isset($parts['port']) ? ':' . $parts['port']:null) . ';dbname='
. $parts['database'];
break;
case 'mysql':
case 'informix':
case 'oci8':
case 'oci':
case 'mssql':
case 'firebird':
case 'dblib':
case 'pgsql':
case 'odbc':
case 'mock':