perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perrin Harkins <>
Subject Re: Apache::DBI question
Date Sat, 14 Jan 2006 05:05:06 GMT
Jonathan Vanasco wrote:
> well yeah.  its just a really weird situation that is easy to get into 
> and not really documented.  i'm kind of surprised this didn't happen to 
> anyone else.   maybe i'm just doing things REALLY wrong :)

Connecting with AutoCommit on and turning it off when you want to do a 
transaction is not common, but that's how I do it.  I don't use 
Apache::DBI.  I use DBI->connect_cached() and have a cleanup handler 
issue a rollback at the end of every request.

>> Sure, you can catch it like any other exception.  I think you'll find 
>> that when it dies it goes back to the original settings, i.e. 
>> AutoCommit 0.  I thought it would also do a rollback on an error, but 
>> maybe not.
> I thought/assumed it would/did too :(

It may be only if you use local to change AutoCommit, e.g.

   # transaction block
   local $dbh->{'AutoCommit'} = 0;

I thought I remembered seeing something about this in the DBI code though.

- Perrin

View raw message