You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, it always returns the originally selected database.
This behavior is consistent across drivers. They all try to use the value from the configuration and fall back to the value reported by the connection which causes the inconsistency.
2. Depending on the authentication method
Most of the drivers support external authentication where most if not all connection parameters including username and database can be omitted and will be picked up by the driver from another place (e.g. php.ini, OS configuration, etc).
For instance, in order to connect to an Oracle database via oci8 using external authentication, one needs to specify / as the user name. If Connection::getDatabase() is called on such a connection, it will return /, not the current database. The same example can be made for most of the supported drivers.
The text was updated successfully, but these errors were encountered:
The
Connection::getDatabase()
method description looks like following:dbal/lib/Doctrine/DBAL/Connection.php
Lines 232 to 233 in 6820036
This is a bit unclear and doesn't always work in the same way.
1. Depending on the connection parameters
Consider the example:
The above looks correct since it returns the currently selected database.
Here's another example:
Here, it always returns the originally selected database.
This behavior is consistent across drivers. They all try to use the value from the configuration and fall back to the value reported by the connection which causes the inconsistency.
2. Depending on the authentication method
Most of the drivers support external authentication where most if not all connection parameters including username and database can be omitted and will be picked up by the driver from another place (e.g. php.ini, OS configuration, etc).
For instance, in order to connect to an Oracle database via
oci8
using external authentication, one needs to specify/
as the user name. IfConnection::getDatabase()
is called on such a connection, it will return/
, not the current database. The same example can be made for most of the supported drivers.The text was updated successfully, but these errors were encountered: