I've sifted through the years of archives on how to
tell if a prior database handle established using
DBI->connect_cached exists or not. Any examples
that I have found do not work for my needs. While the
$dbh->{CachedKids} is useful for showing any cached
statements when using $dbh->prepare_cached, I cannot
get a similar function (DBI->{CachedKids} ??) to work
at the driver level in order to see if a handle
already exists.
My application is a persistent CGI application
(Fast:CGI) that logs onto one of many databases based
on the user's input. Using the $DBI->connect_cached
is pooling the connections perfectly, but I also want
to do some one-time session setup (the usual
NLS_DATE_FORMAT stuff) for any new connections only.
I can't find a way to see if the connection already
exists. If there is a way, can someone give an
example??
I could store each handle in my own hash and do a
$dbh->ping to see if the connection is still valid.
If its not valid or the ping fails, re-establish and
run the one-time session setup. However, that seems
to duplicate most of Tim's DBI->connect_cached code.
Oh well, you can never have too many wheels ;)
Thanks,
Tom
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com