Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
ea803566
Commit
ea803566
authored
Nov 03, 2007
by
meus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix dsn so that
sqlite:///full/unix/path/test.db
and
sqlite://c:/full/windows/path/test.db
works
parent
1945b0d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
Manager.php
lib/Doctrine/Manager.php
+10
-0
ManagerTestCase.php
tests/ManagerTestCase.php
+3
-3
No files found.
lib/Doctrine/Manager.php
View file @
ea803566
...
...
@@ -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'
];
}
...
...
tests/ManagerTestCase.php
View file @
ea803566
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment