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

Jesper Krogh jesper at krogh.cc
Sun Oct 21 11:37:20 GMT 2007


Darren Duncan wrote:
> At 10:43 AM +0200 10/20/07, Jesper Krogh wrote:
>> 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?)
> 
> Each individual SQL statement is conceptually supposed to be atomic,
> like it was an implicit transaction, regardless of the presense of any
> explicit transactions, so a failing single statement should never leave
> an inconsistent database.  In actuality, some DBMSs claim to do this
> (even MySQL?), and others not necessarily.  Explicit transactions are
> mainly to make a succession of multiple SQL statements collectively atomic.
> 
> But regardless, if there is a concern that an individual SQL statement
> isn't atomic, then autocommit should still equal 1, and an explicit
> transaction, eg with txn_do, should be wrapped around the single
> statement, in order to "make sure".

Ok.. maybe I didnt make it clear. The problem is that we "serialize"
object into several records (over 20 mostly) and this serialization
process should be done atomically, so I don't get any "half-objects" in
the database. It wasn't the individual record I was talking about.

This dataset is conceptually "inconsistent" to the application if this
happens. But the database is of course not aware of this.

txn_begin/commit and txn_do solves this.

Jesper
-- 
Jesper Krogh, jesper at krogh.cc




More information about the DBIx-Class mailing list