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

Perrin Harkins pharkins at gmail.com
Fri Mar 27 18:53:21 GMT 2009

On Fri, Mar 27, 2009 at 2:20 PM, Carlos Vicente
<cvicente at network-services.uoregon.edu> wrote:
> Is this necessary when using Ima::DBI via Class::DBI?

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

> After 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

More information about the ClassDBI mailing list