[Catalyst] How safe are database transactions?

2007-01-04 Thread Xavier Robin
Hello all, I'm sorry if it is the wrong list, but I thought it was more a Catalyst-specific issue than a DBIx::Class one, as it is about the way Catalyst uses DBIx::Class. I would like to use transactions in Catalyst. my $transaction = $c-model('MyAppDB')-storage; $transaction-txn_begin; eval

Re: [Catalyst] How safe are database transactions?

2007-01-04 Thread Ash Berlin
Xavier Robin wrote: Hello all, I'm sorry if it is the wrong list, but I thought it was more a Catalyst-specific issue than a DBIx::Class one, as it is about the way Catalyst uses DBIx::Class. I would like to use transactions in Catalyst. my $transaction = $c-model('MyAppDB')-storage;

Re: [Catalyst] How safe are database transactions?

2007-01-04 Thread Kay Sindre Bærulfsen
On 1/4/07, Xavier Robin [EMAIL PROTECTED] wrote: [...] my $transaction = $c-model('MyAppDB')-storage; $transaction-txn_begin; eval { # Do some insertions with $c-model('MyAppDB::Table')-create() }; if ($@) { $transaction-txn_rollback; } else { $transaction-txn_commit; } Fist of

Re: [Catalyst] How safe are database transactions?

2007-01-04 Thread Chisel Wright
On Thu, Jan 04, 2007 at 11:11:10AM +, Ash Berlin wrote: $c-model('MyAppDB')-txn_do(sub { # Do some insertions here }); Yes, this is pretty much how I do it too, e.g.: sub _add_new_reply { my ($self, $c) = @_; my ($new_reply); # some checks # otherwise, the form

Re: [Catalyst] How safe are database transactions?

2007-01-04 Thread Bill Moseley
On Thu, Jan 04, 2007 at 10:45:49AM +0100, Xavier Robin wrote: Hello all, I'm sorry if it is the wrong list, but I thought it was more a Catalyst-specific issue than a DBIx::Class one, as it is about the way Catalyst uses DBIx::Class. Related to Catalyst, my do_transaction is in my base

Re: [Catalyst] How safe are database transactions?

2007-01-04 Thread Perrin Harkins
Xavier Robin wrote: I mean, my application died once before the rollback and everything went wrong. I think this is because Catalyst connects only once, so all the work is done under the same connexion. That doesn't really make sense. It can't use the same connection from different