Re: [CDBI] Ima::DBI with Class::DBI question

Perrin Harkins <[email protected]> Fri, 27 Mar 2009 14:53:21 -0400
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On Fri, Mar 27, 2009 at 2:20 PM, Carlos Vicente
<cvicente-zZ82ZiX1S8l+u43qRgrggVnYRNhDb3e+9nwVQlTi/[email protected]> wrote:
> Is this necessary when using Ima::DBI via Class::DBI?

Yes, if you use transactions, i.e. ever turn off AutoCommit.

>=A0After adding this (in my Mason handler), I started seeing these errors =
in my Apache logs:
>
> DBD::mysql::db rollback failed: Rollback ineffective while AutoCommit is =
on at /usr/lib/perl5/site_perl/5.8.8/Ima/DBI.pm line 596

You can make the CleanupHandler check if AutoCommit is on or not
before attempting to roll back.  If you normally have it on, you might
check if it's off, do a rollback if it is, and then turn it back on.

This protects you from an uncaught error inside a transactional block
leaving your database handle in a bad state.

- Perrin