[CDBI] class::dbi::loader and transaction

Perrin Harkins perrin at elem.com
Tue Nov 21 16:49:45 GMT 2006


James. L wrote:
> in do_transaction, i can
> only pass a particular table class but it won't roll
> back the changes on other tables when failed. 

No, transactions are at the database level.  A rollback affects all work 
done since the last commit.  It has nothing to do with your classes.

> I guess that i need a base class like Music::DBI or
> something? 

Not really.  You don't need that "do_transaction" sub at all.  All you 
have to do is turn off AutoCommit and call dbi_commit() or 
dbi_rollback().  If you want to use it though, it probably is best in a 
base class.

- Perrin



More information about the ClassDBI mailing list