Commit ea803566 authored by meus's avatar meus
parent 1945b0d7
......@@ -350,6 +350,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
public function parseDsn($dsn)
{
//fix linux sqlite dsn so that it will parse correctly
$dsn = str_replace("///", "/", $dsn);
// silence any warnings
$parts = @parse_url($dsn);
......@@ -373,6 +378,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
$parts['database'] = ':memory:';
$parts['dsn'] = 'sqlite::memory:';
} else {
//fix windows dsn we have to add host: to path and set host to null
if (isset($parts['host'])) {
$parts['path'] = $parts['host'] . ":" . $parts["path"];
$parts["host"] = null;
}
$parts['database'] = $parts['path'];
$parts['dsn'] = $parts['scheme'] . ':' . $parts['path'];
}
......
......@@ -65,8 +65,8 @@ class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase {
// sqlite://full/unix/path/to/file.db
// It expects only // since it thinks it is parsing a url
// The problem after that is that the dns is not valid when being passed to PDO
$sqlite = 'sqlite:/full/unix/path/to/file.db';
$sqlitewin = 'sqlite:c:/full/windows/path/to/file.db';
$sqlite = 'sqlite:///full/unix/path/to/file.db';
$sqlitewin = 'sqlite://c:/full/windows/path/to/file.db';
$manager = Doctrine_Manager::getInstance();
......@@ -110,9 +110,9 @@ class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase {
try {
$expectedDsn = array(
"scheme" => "sqlite",
"host" => null,
"path" => "c:/full/windows/path/to/file.db",
"dsn" => "sqlite:c:/full/windows/path/to/file.db",
"host" => null,
"port" => NULL,
"user" => null,
"pass" => null,
......
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