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

Carlos Vicente cvicente at network-services.uoregon.edu
Fri Mar 27 20:09:00 GMT 2009


On Fri, 2009-03-27 at 14:53 -0400, Perrin Harkins wrote:
> 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

Understood.  

Thanks for your help!

cv



More information about the ClassDBI mailing list