[Dbix-class] ->storage->disconnect() Required After Using SQLite?

Steven Mackenzie dbix at aptile.co.uk
Wed Oct 4 11:20:15 CEST 2006


Kiki wrote:

>Jess Robinson wrote:
>  
>
>>.. Although all the connect examples about use AutoCommit => 0, is there a 
>>good reason for this, I wonder? Are there any good reasons to turn off 
>>AutoCommit with DBIC at all?
>>
>>Jess
>>  
>>    
>>
Thanks for pointing me back at that doc, my eyes obviously translated
"off" to "on" when I read it the first time.

What I had been looking for was a list of the options that I can pass to
connect, and what they do, but that isn't there?

>Saves you a $dbh->begin_work call. Granted, depending on where you start
>looking (connection options or code) it might not be obvious from the
>beginning that there are transactions afoot. But it's easier/quicker to
>just set AutoCommit => 0, so you can
>
><do stuff>
>$dbh->commit;
>...
><do stuff>
>$dbh->rollback;
>
>than to put $dbh->begin_work at the start and after each commit/rollback
>call. Can be a good thing, YMMV.
>
>  
>
It's like an AutoTransaction option then? I don't really like that
because it means you have to mix the DBIx::Class API with whatever API
your storage offers. 

Does anyone else feel the attribute name "AutoCommit" is counter intuitive?

The actual behaviour (when AutoCommit=>1) is allow DBIx::Class to manage
transactions and auto commit unless explicit transactions calls (txn_*)
are made.

When AutoCommit=>0 the user must manages transactions directly on the
dbh or whatever storage is used.

Maybe that interpretation didn't occour to me because I've never used
the DBI API?

Thanks for the help everyone

Steven



More information about the Dbix-class mailing list