Commit 5aec5359 authored by Max Romanovsky's avatar Max Romanovsky

Fixed: MySQL Driver didn't return Database name if DBAL was initialized using existing PDO instance

parent f62b4a5d
......@@ -71,7 +71,7 @@ class Driver implements \Doctrine\DBAL\Driver
if (isset($params['charset'])) {
$dsn .= 'charset=' . $params['charset'] . ';';
}
return $dsn;
}
......@@ -93,6 +93,10 @@ class Driver implements \Doctrine\DBAL\Driver
public function getDatabase(\Doctrine\DBAL\Connection $conn)
{
$params = $conn->getParams();
return $params['dbname'];
if (isset($params['dbname'])) {
return $params['dbname'];
}
return $conn->query('SELECT DATABASE()')->fetchColumn();
}
}
\ No newline at end of file
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