If I have a database handle, is it possible to get back the username,
password, attributes and data source?  That is... I have a database
handle and I wish to reconnect using just information from it.

This is so Class::DBI can take an existing database handle rather than
the connection attributes.

        # Instead of this...
        My::Class::DBI->set_db('Main', $data_source, $user, $pass);

        # You can do this...
        My::Class::DBI->set_db('Main', $dbh);

Because Class::DBI connects on demand and reconnects should the
connection fail, I need to be able to pass the stuff to connect() just
form the $dbh.  I can munge this data from, of all places, the
connect_cached cache.  Basically doing a reverse lookup on
$drh->{CachedKids} for my $dbh and then pulling apart the key its
stored under.  Very messy.  Please don't make me do that.


I can see how you'd be wary to store, much less expose, the password
to the user.  Perhaps a reconnect() method?  $dbh->reconnect unless
$dbh->ping;


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Now you must be saying, "Alex Chiu, this Chinaman, you're crazy!"
             --Alex Chiu, Immortality Guy

Reply via email to