Commit 85e9508e authored by Erik Weatherwax's avatar Erik Weatherwax Committed by Steve Müller

When creating sqlite connections from a url with DriverManager, pass the...

When creating sqlite connections from a url with DriverManager, pass the 'path' key the driver expects instead of the 'dbname' key other drivers expect.
parent af38e30a
......@@ -258,10 +258,14 @@ final class DriverManager
}
if (isset($url['path'])) {
$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:')) {
$params['dbname'] = $url['path']; // if the URL was just "sqlite::memory:", which parses to scheme and path only
$params[$nameKey] = $url['path']; // if the URL was just "sqlite::memory:", which parses to scheme and path only
} else {
$params['dbname'] = substr($url['path'], 1); // strip the leading slash from the URL
$params[$nameKey] = substr($url['path'], 1); // strip the leading slash from the URL
}
}
......
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