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