Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass "path" to pdo-sqlite drivers from DriverManager instead of "dbname" #2267

Merged
merged 2 commits into from
Jan 8, 2016

Conversation

erikjwaxx
Copy link
Contributor

This fixes #1106. Any input on the correct way to do this per Doctrine coding standards is welcome.

…the 'path' key the driver expects instead of the 'dbname' key other drivers expect.
$nameKey = isset($url['scheme']) && strpos($url['scheme'], 'sqlite') !== false
? 'path' // pdo_sqlite driver uses 'path' instead of 'dbname' key
: 'dbname';

if (!isset($url['scheme']) || (strpos($url['scheme'], 'sqlite') !== false && $url['path'] == ':memory:')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow try to avoid duplicate checks on whether the path is a sqlite path here?
Also I think it would be a good idea to consider setting memory parameter instead of path parameter, if the URL path refers to in-memory (it makes no difference for the driver but could be useful in userland when checking for specific parameters IMO).

Otherwise this patch looks good to me.

@billschaller
Copy link
Member

👍

@deeky666 deeky666 added the Bug label Jan 5, 2016
@deeky666 deeky666 added this to the 2.5.4 milestone Jan 5, 2016
@deeky666 deeky666 self-assigned this Jan 5, 2016
@Ocramius Ocramius removed this from the 2.5.4 milestone Jan 5, 2016
@deeky666 deeky666 added this to the 2.5.5 milestone Jan 8, 2016
@deeky666 deeky666 merged commit b19626a into doctrine:master Jan 8, 2016
deeky666 added a commit that referenced this pull request Jan 8, 2016
Pass "path" to pdo-sqlite drivers from DriverManager instead of "dbname"
@deeky666
Copy link
Member

deeky666 commented Jan 8, 2016

Merged manually, added evaluation of memory connection parameter and refactored logic. @erikjwaxx thanks!

@deeky666
Copy link
Member

deeky666 commented Jan 8, 2016

Backported to 2.5 branch via 85e9508, 096f59d, b1cbe8c

@stof
Copy link
Member

stof commented Jan 19, 2016

@deeky666 do you have an ETA for a 2.5.5 release including this fix ? This would allow symfony/demo#297 (comment) to work.

@deeky666
Copy link
Member

@stof depends on review and merge capabilities of @Ocramius and @zeroedin-bill. Would like to get the open PRs targeted for 2.5.5 get merged first but it is not a MUST. We could also release earlier if desired.

@laoneo
Copy link

laoneo commented May 5, 2016

We need it as well as soon as possible 😄 Thanks.

laoneo added a commit to joomla-x/joomla-pythagoras that referenced this pull request May 5, 2016
When doctrine DBAl version 2.5.5 is released the change can be reverted,
till then we need the commit
doctrine/dbal@2c34559
from the PR doctrine/dbal#2267
klemens added a commit to klemens/StrigelCMS that referenced this pull request Nov 13, 2016
This fixes a bug when using a sqlite connection string [1].

[1]: doctrine/dbal#2267
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DBAL-1164: Creating SQLite Connections via a URL Does Not Work
6 participants