[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: PATCH: Apache::DBI: Enabling rollback of $dbh's
From:       Tim Bunce <Tim.Bunce () ig ! co ! uk>
Date:       1999-05-31 22:40:05
[Download RAW message or body]

On Mon, May 31, 1999 at 10:21:05PM +0200, Edmund Mergl wrote:
> 
> Apache->push_handlers(PerlCleanupHandler => sub {
> print STDERR "$$ Apache::DBI PerlCleanupHandler \n" if $Apache::DBI::DEBUG;
> if (! $Connected{$idx}->{AutoCommit}) {
> print STDERR "$$ Apache::DBI PerlCleanupHandler: rollback for $args[0] \n" if \
> $Apache::DBI::DEBUG; $Connected{$idx}->rollback;
> }
> });

I'd make the logic something like this:

 ... = sub {
	my $dbh = $Connected{$idx};
	eval {
	    $dbh->rollback if $dbh && $dbh->{Active} && !$dbh->{AutoCommit};
	}
  }

The Active test skips disconnected handles and the eval is required for
handles with RaiseError set incase the rollback fails.

Tim.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic