Fix a subtle bug in MasterSlaveConnection::getDatabase().

The Connection::getDatabase() method can execute the query() method
in order to perform a SELECT DATABASE() query to get the current
database name.

The MasterSlaveConnection cannot reuse such a behavior because the
execution of the query() method will cause the instant connection
to the master database, defeating the purpose of the getDatabase()
method for any slave.

This change considers only the database name in the configuration,
ignoring any possible subsequent database change.