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

Jess Robinson castaway at desert-island.demon.co.uk
Wed Oct 4 08:50:52 CEST 2006



On Tue, 3 Oct 2006, Brandon Black wrote:

> On 10/3/06, Steven Mackenzie <dbix at aptile.co.uk> wrote:
>>
>>  Hello,
>>
>>  DBD::SQLite::VERSION 1.12
>>  DBIx::Class::VERSION 0.07001
>>
>>  I'm running a script to patch an error in my database. It loops over
>>  each bad row and fixes it, and works fine, except that it requires me to
>>  have
>>  $data->storage->disconnect();
>>  at the end of it, otherwise I get this message:
>>  Issuing rollback() for database handle being DESTROY'd without explicit
>>  disconnect().
>
>
>
> Try setting AutoCommit => 1 instead of 0, I think your code will work
> correctly and it might get rid of that message.  IIRC DBIC's transaction
> support doesn't depend on the state of AutoCommit, and AutoCommit => 1 will
> generally give you more "expected" behavior.

Quoth the POD:

        txn_begin

        Begins a transaction (does nothing if AutoCommit is off). Equivalent to
        calling $schema->storage->txn_begin. See "txn_begin" in
        DBIx::Class::Storage::DBI for more information.

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



More information about the Dbix-class mailing list