[Catalyst] how to implement Transactions (over different
db tables) in a Catalyst project
Tomas Doran
bobtfish at bobtfish.net
Mon Jul 6 10:56:01 GMT 2009
Tomas Doran wrote:
> $c->model('myAppDB')->txn_do( sub {
> my $rs = $c->model('myAppDB::Table')->search(..);
> # Etc etc
> die("Rollback") if $foo; # Exceptions cause rollback
> # Etc etc
> # If you get here, to the end, transaction is committed for you.
> });
And I'm crap.
You need $c->model('myAppDB')->schema->txn_do( sub {
Cheers
t0m
More information about the Catalyst
mailing list