These patches were originally by Patrick Mulvany, and posted to mod_perl
in 2003. I've made sure they apply to Apache-DBI-0.99, and are
compatible with my re-scoping of $Idx.
The ping patch looks obviously correct to me. It makes sure that the
database is always pinged on connect() if PingTimeOu
> While you're at it, can you post 2 separate ones instead of 1.
Here's the first patch. It moves $Idx from being a file-scoped variable
to connect() scope. The cleanup handler is then passed a closure
containing $Idx:
$s->push_handlers("PerlCleanupHandler", sub { cleanup($Idx) });
or
> I'll attempt take a look at this sometime this week. At first glance
I
> think I have some questions about it. I'll get back to you after more
> thorough investigation.
>
> Please CC the modperl@perl.apache.org list as I'm not technically the
> maintainer, Ask still is, and its supposed to
Brian Dimeler wrote:
So anyway, I recompiled mod_perl to ensure these kinds of handlers
were enabled, restarted the server with $Apache::DBI::DEBUG set to 2,
and sure enough, I started getting debug messages about rollbacks
after each script finished executing. Problem is.. they stopped, after
I sent a patch that touches some of the same code a couple months back, and
I never got any feedback on it. It fixes a bug where database handles won't
get rolled back properly if there's more than one handle in use, because
$Idx can only keep track of one handle at a time:
http://mathforum.org/
A couple days ago, I posted a patch that fixed what I think is a real bug in
Apache::DBI when a script uses more than one database handle:
http://mathforum.org/epigone/modperl/stroblangnerm
Basically, I removed $Idx as a file-scoped variable, because if a script
used more than one database handle
This patch should make the cleanup handlers roll back all database handles
that have been used in a script, rather than just the last one connected.
Currently, $Idx is a file-scoped variable, and gets overwritten with each
call to Apache::DBI::connect.
I've made $Idx a lexical variable scoped to c