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? Is my workaround appropriate? Why is the
Active test even in Apache::DBI?

Reply via email to