« Return to Thread: how to implement Transactions (over different db tables) in a Catalyst project

Re: how to implement Transactions (over different db tables) in a Catalyst project

by Tomas Doran :: Rate this Message:

Reply to Author | View in Thread

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


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

 « Return to Thread: how to implement Transactions (over different db tables) in a Catalyst project