[Catalyst] DBIx Class Transactions in catalyst
Charles
cshtreck at yahoo.com
Mon Sep 4 02:58:10 CEST 2006
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.
Thanks
C.
--- Brandon Black <blblack at gmail.com> wrote:
> On 9/2/06, Charles <cshtreck at yahoo.com> wrote:
> >
> >
> > Is there something obvious that I'm missing ?
>
>
> Yes. In order to generate the subref, you have to
> use the "sub" keyword.
> Change this line in your example:
>
> my $coderef = {
>
> To:
>
> my $coderef = sub {
>
> Seperately, if that example is what you're actually
> doing, it sounds like
> you're trying to use this to emulate
> autoincrementing primary keys. I'm
> pretty sure most dbms's support such keys natively,
> without you having to
> use this select max hack.
>
> -- Brandon
> > _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Catalyst
mailing list