|Think about Loose Coupling|
DBI driver name from database handleby liz (Monsignor)
|on Oct 20, 2003 at 14:42 UTC||Need Help??|
liz has asked for the
wisdom of the Perl Monks concerning the following question:
Is there an official way to obtain the driver name from a DBI database handle (object of type "DBI::db")?
Suppose I have a class method in an external module:
Now, after I obtain the database handle, I want to know which subclass of my own module I would need to bless an object with. Ideally:
and of course, I would then have a module Foo::mysql:
I can't find any easy way to do this, apart from possibly trying to do a query of some sort and inspect the class of the statement handle. If that would to be the way to do it, what would be an SQL statement that would work with all possible database drivers?
The appropriate doc (which is indeed in DBI, but which I didn't find):