[Dbix-class] ROLLBACK seems to be skipped on 0.08

Jesper Krogh jesper at krogh.cc
Sat Oct 20 09:43:15 GMT 2007


Matt S Trout wrote:
> On Fri, Oct 19, 2007 at 10:28:38AM +0200, Jesper Krogh wrote:
>> AutoCommit is 0 .. you can see it above, thats by intention.
> 
> AutoCommit 0 has been considered undefined for DBIC for some time.

I've failed to notice that.

> DBIC provides safe transaction primitives. Use them please.

The $schema->txn_do ?

> (note: I'd love if you can help Brandon find the problem but you should
> only ever use AutoCommit 0 with DBIx::Class if the $dbh needs to be shared
> with legacy code that requires it; there is no reason whatsoever to do so
> otherwise, DBIC's transaction primitives are both more effective and more
> robust)

It was my impression that passing AutoCommit => 1 goes directly to the
$dbh (correct me if I'm wrong?)

And that AutoCommit => 1 makes every UPDATE/INSERT/DELETE in the
database, to work as a single entity (correct me if I'm wrong here?)

The case is that we "serialise" some objects into several relations in
the database and want to encapsulate the complete
"object-write"/"object-update" procedure as a complete transaction to
make sure that we dont get any "half" objects in the database if
comething goes wrong. If I'm not wrong in one of the above cases, then I
cant see how setting AutoCommit => 1 doesn't open up the situation where
I might get an inconsistent database?

(I'll test Brandons suggestion tonight)

Jesper
-- 
Jesper Krogh, jesper at krogh.cc




More information about the DBIx-Class mailing list