On Mon, Jan 13, 2003 at 02:08:12PM -0500, Bob Showalter wrote:
> I'm using Apache::DBI under mod_perl to manage connections to a remote
> database using DBD::Proxy. My problem is that Apache::DBI is not properly
> issuing a rollback to DBD::Proxy handles in the PerlCleanupHandler.
>
> The relevant section from Apache/DBI.pm is (in sub cleanup):
>
> if ($Rollback{$Idx} and $dbh and $dbh->{Active} and !$dbh->{AutoCommit}
> and eval {$dbh->rollback}) {
> print STDERR "$prefix PerlCleanupHandler rollback for $Idx \n" if
> $Apache::DBI::DEBUG > 1;
> }
>
> The problem is with the $dbh->{Active} test. This flag doesn't seem to be
> true for DBD::Proxy database handles, and thus the $dbh->rollback isn't
> happening.
>
> I am working around this with the following:
>
> BEGIN {
> use DBD::Proxy;
> $DBD::Proxy::db::ATTR{Active} = 'remote';
> }
>
> This code tells DBD::Proxy to pass the fetch of "Active" to the remote
> handle. This seems to work and the rollback happens.
>
> Should this be considered a bug?
Yes. Thanks for reporting it.
> Is my workaround appropriate?
It works and is technically correct, but it's possibly not the most
efficient way of 'fixing' the Active flag (makes checking Active slow).
I'll probably just do just that for now for the next release :)
> Why is the Active test even in Apache::DBI?
Probably to avoid calling rollback on a disconnected handle which might
upset some drivers and maybe generate PrintError or HandleError output.
Tim.