RE: Retrieving the CURRENT default database name

"Wechsler, Steven" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <B369AF8BFEE6D6499AEF9C24E2B77E8B9364B519@ABFABNJ03B.mtvn.ad.viacom.com>
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:[email protected]] 
Sent: Monday, October 22, 2012 1:19 PM
To: [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.