[Catalyst] how to implement Transactions (over different db tables) in a Catalyst project

Joel Bernstein joel at fysh.org
Mon Jul 6 12:25:59 GMT 2009


On 6 Jul 2009, at 12:38, kakimoto at tpg.com.au wrote:

> So, in the case of an exception, an automatic rollback will take  
> place.
> I have tested this in my application and it seems that way.

Did you look what the code does?
http://cpansearch.perl.org/src/RIBASUSHI/DBIx-Class-0.08107/lib/DBIx/Class/Storage.pm
and http://cpansearch.perl.org/src/RIBASUSHI/DBIx-Class-0.08107/t/81transactions.t

See sub txn_do. It begins a transaction, runs your coderef inside an  
eval, rolls back the transaction if the eval raises an exception.

However, this is NOT a Catalyst question. Please subscribe to the  
DBIx::Class users list at:
http://lists.scsys.co.uk/mailman/listinfo/dbix-class/ and ask these  
questions there. Many of the subscribers are the same, but many  
Catalyst users don't use DBIx::Class, and many knowledgeable DBIC  
users are not subscribed here. It's just good hygiene to ask the  
questions in the appropriate places.

Questions specific to Catalyst::Model::DBIC::Schema are fine here, but  
you must realise that everything after C< $c->model("MyDBICSchema") >  
or C< $c->model("MyDBICSchema::MyResultSetClass") > is handled by  
DBIx::Class and has nothing to do with Catalyst?

Thanks,

/joel



More information about the Catalyst mailing list