[Catalyst] DBIx Class Transactions in catalyst
Charles
cshtreck at yahoo.com
Sun Sep 3 00:00:28 CEST 2006
I've read through the transaction examples in
DBIx::Class::Schema and
I've been trying to get the following to work via
transactions . First some simple definitions:
Consider table T w/ a single column named number. I'm
trying to insert a new row that would contain the
result of 'select MAX(row)+1' ;
number <<= Table T
------
4
5
6
So, in Catalyst w/o transactions I have ...
my $max_number =
$c-model('MyDB::T')->get_column('number')->max;
$max_number++;
$c->model('MyDB::T')->create({
number => $max_number, });
And this works fine, but when I try this w/
transactions I get no error messags and no update
to table T.
my $coderef = {
my $max_number =
$c-model('MyDB::T')->get_column('number')->max;
$max_number++;
$c->model('MyDB::T')->create({
number => $max_number, });
};
eval {
$c-model('MyDB::T')->schema->txn_do($coderef);
}
The db log shows 'selet MAX(number) from T me'
but there's no evidence of a BEGIN,COMMIT or ROLLBACK.
Is there something obvious that I'm missing ?
Charles
__________________________________________________
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