>> I'm using a dbi handle that is shared between many packages in my >> code. Some package might do a "USE db_name" to change the current >> database of the connection. Can I retrieve the current database name >> from the handle, either from DBI or from the DBD::mysql driver >> (without querying the server)? > > What's wrong with 'perldoc DBI'? > > What's the name attribute of a database handle documented as doing? > > Does it not work for you?
Hello Jonathan, thanks for your reply. >From perldoc: > Name [...] > Usually (and recommended to be) the same as the "dbi:DriverName:..." string > used to connect to > the database, but with the leading "dbi:DriverName:" removed. So Name returns the dsn used to connect, it is not meant to be the "current" database (it's not updated when changing database by doing "USE <db-name>"). I want something that is dynamic, similar to doing a "SELECT DATABASE()" query in mysql, but without doing an actual query. Sorry if I wasn't clear enough in my previous mail. > And please don't double post without waiting for an answer or explaining > your double post. I double posted because, after posting, I found a message (admittedly an old one) saying that "messages posted on google.groups DO NOT reach [EMAIL PROTECTED]", so I thought my first post would be ignored. I should have explained the reason though, I agree. Kostas