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

Jesper Krogh jesper at krogh.cc
Sat Oct 20 19:18:31 GMT 2007


Brandon Black wrote:
> On 10/20/07, Jesper Krogh <jesper at krogh.cc> wrote:
>> Brandon Black wrote:
>>> What AutoCommit => 1 does is make it so that if you aren't in an
>>> explicit transaction at the DBI (or DBIC) level, every statement is
>>> committed as an individual transaction.  It doesn't prevent you from
>>> using multi-statement transactions.  AutoCommit => 1 is generally
>>> better all around, regardless of DBIC (but especially with DBIC), for
>>> a lot of obvious (and a few non-obvious) reasons.
>> I feel "safer" with manually controlling the transactions. I may just
>> need to get to work with txn_do() so I can adjust my feelings :-)
>>
>> I had a "nice" feeling using AutoCommit => 0, knowing that stuff ONLY
>> got into the database if I actually wanted it to.
>>
>> I've been writing a lot of "DB-fix"-scripts which I intentinally ran with:
>> $schema->txn_begin;
>> A lot of fixup.
>> $schema->txn_rollback;
>>
> 
> Or you can turn on AutoCommit, and make all your blocks:
> 
> $schema->txn_do(sub {
> # a lot of fixup
> });

AutoCommit => 1 and txn_do does not give me the option to intentionally
do a ROLLBACK, does it?

>>> I'm leaning towards what I said earlier: requiring AutoCommit => 0
>>> people to explicitly start their transactions before doing any work
>>> (txn_begin or txn_do), and basically dropping support for AutoCommit
>>> => 0 and implicit txn starts.
>> That sounds reasonable to me.
>>
> 
> I'll work out a patch for this sometime this weekend, we'll see on IRC
> where it should go, as far as who it breaks, etc.

Cool!

Jesper
-- 
Jesper Krogh, jesper at krogh.cc




More information about the DBIx-Class mailing list