Meir,

The maven that you consulted with must not have been very mavenish. A quick 
Google search found the database() function:

http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_database

It goes back to at least MySQL 5.0.

Steve

-----Original Message-----
From: Meir Guttman [mailto:m...@guttman.co.il] 
Sent: Monday, October 22, 2012 1:19 PM
To: dbi-users@perl.org
Subject: Retrieving the CURRENT default database name

Dear mavens,
My application interacts with a MySQL DBMS. There I am using subroutines and 
packages that set the various attributes passed to the DBI "connect" method.
Also, I later switch databases based on a user's input by executing a "USE 
'DB_name'" SQL statement.
What I am after is a way to debug my application and/or log a particular run to 
verify what was actually selected as the "default database name" at any given 
juncture. A bug there might be devastating....
Unfortunately, a real SQL maven says
(http://forums.mysql.com/read.php?10,571841,571848) that no SQL statement 
exists to retrieve the currently set database.
I searched the web to find a way to do so, without success. Is there a DBI (or 
DBD?) way to do so?
Regards
Meir


Reply via email to