Is there any way of retrieving the information associated with the current MySQL connection? I suppose that the username and password would not be retrievable for security reasons, but what about the hostname and currently selected database?
The reason is so that I can write a modular function that selects a different database, does some queries on it, and then re-selects the original database before returning.
I've dug through the PHP and MySQL manuals, but haven't found anything.