Gunther Birznieks wrote:
Stas Bekman wrote:
Hill, Ronald wrote:
It's much simpler than that. You need two sentences:
1) under mod_perl, globals remember their values from the previous
request, so you can cache the connection with:
$dbh ||= myconnect();
But Apache::DBI implements pinging (immediate or timing based) which is
much superior to this. Some databases drop connection otherwise. Or
consider the case where the database goes down and then all the $dbh
becomes invalid. Apache::DBI would recover gracefully I think. But the
above method wouldn't.
You are correct.
2) If you rdbms supports cached statement handles (which most do), you
can use Apache::DBI which caches database connection without needing
to change any of your code.
I am not aware of Apache::DBI caching statement handles. Are you sure
that Apache::DBI does this?
Ah, sorry, wrong copy-n-paste. i wanted to say connection.
Thanks for correcting me!
Or is it a side effect of caching the database handle.
If it is the latter, then then caching with #1 above would not solve the
problem. If it is the former, perhaps someone can add a global setup
variable to Apache::DBI to turn this feature off.
eg
$Apache::DBI::statement_handle_caching = 0; # default = 1
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com