AnyEvent::DBI and transactions

Marc Lehmann schmorp at schmorp.de
Thu Apr 17 09:08:46 CEST 2014


On Tue, Apr 15, 2014 at 01:53:53PM +0300, Andrey Khlopenov <khlopenov.andrey at gmail.com> wrote:
> Is there right way to work with AnyEvent::DBI and transactions?

Basically the same way as with DBI - you start a transaction, do stuff,
then commit or rollback.

> I receive an error "Already in a transaction" in 2 .. 10 iterations of
> cycle(even if I do some hard work at begin of the cycle before each
> transaction).

You cannot start a new transaction while a transaction is in progress -
you first have to call ->commit or ->rollback to finish the transaction,
and then you can start a new one.

In your loop, you call begin_work multiple times in a loop, without
issuing a commit in between.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list