[Catalyst] DBIx Class Transactions in catalyst

Matt S Trout dbix-class at trout.me.uk
Mon Sep 4 13:23:16 CEST 2006


Charles wrote:
> Thanks for the reply. I've actually had
> 
> 'my $coderef = sub {'
> 
> in my code . My posted example was missing this piece.
> 
> In any event I get no 'BEGIN' , 'COMMIT'  or ROLLBACK
> messages in my mysql.log file. 
> 
> I think I just realized something though. For this
> example I stripped away all non-pertinent columns
> including the primary key col which is auto
> incremented. I have always  
> been used to using autoincrement for my primary keys
> as a habit. It never occured to me to use
> autoincrement for other columns that needed to be ....
> well, autoincremented. (sigh)  Thanks. This is what
> happens when I spend too much time staring at my own
> code.
> 
> It still would've been nice to get transactions
> working a la txn_do. I'm sure that I'll need this
> feature not too far down the road. I'll prob either
> use the txn_begin,txn_commit, and txn_rollback
> functions explicitly or just use raw sql. At least
> these show up in the mysql query log and have been
> thus far easier to debug/trace.

Make sure you have AutoCommit set to 1 in your connect info so that txn_do can 
actually start a transaction (rather than you being in an implicit one already)

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list