[Dbix-class] Recovering from a failed transaction ?

Richard Robinson catalyst at beulah.qualmograph.org.uk
Wed Aug 8 11:30:55 GMT 2007


I'm still getting to grips with all this, I think I must be missing
something obvious.

I'm playing around with transactions, to get a feel for how they go. So I
have a little block of deletes and updates, called with

eval { $schema->txn_do($coderef); };

all very much as per the DBIx::Class::Storage doc. Run it with DBIC_TRACE
and I can see it go "BEGIN WORK ...<statements> ... COMMIT" (this is mySql),
or write a deliberate error and I see "ROLLBACK", just as I was hoping, all
very nice; until I go back to the calling page (it's a Catalyst app) and try
it again, when it doesn't seem to do the transaction thing any more - the
statements are issued bare, without the surrounding BEGIN WORK / ROLLBACK.
And they run up to the failing one, and duly leave things in a mess - once a
transaction's failed, they seem to be left disabled . Is this the expected
behaviour, is there something obvious that my deal_with_failed_transaction()
should be doing to bring them back to life ?  Or is this an artefact of
(a different) stupidity in my code ?


DBIc v 0.08003 + mySql v 4.1.11, in case it's relevant.

-- 
Richard Robinson
"The whole plan hinged upon the natural curiosity of potatoes" - S. Lem




More information about the DBIx-Class mailing list