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

Jesper Krogh jesper at krogh.cc
Sat Oct 20 18:40:44 GMT 2007


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;

Running it alot of times during development.. knowing that the script
first had an effect on data when I changed the last line. This is an
extremely strong feature).

I'd like to get rid of the implicit transaction.

>> (I'll test Brandons suggestion tonight)
> 
> The suggestion to comment out begin_work in your example is just to
> test a theory about what our AutoCommit => 0 bug is.  I wouldn't
> recommend leaving the code that way, as a future update will probably
> break you when we fix this.  Even given all of the above, we haven't
> actually made the leap of just forcing everyone to use AutoCommit =>
> 1, so we'd still like to fix the bug :)

Commenting out the txn_begin "solves" the problem.

> 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.


Jesper

-- 
Jesper Krogh, jesper at krogh.cc




More information about the DBIx-Class mailing list