develooper Front page | perl.dbd.pg | Postings from August 2011

Re: Transaction wrapper

Thread Previous
From:
Florian Weimer
Date:
August 24, 2011 02:03
Subject:
Re: Transaction wrapper
Message ID:
824o17kwpq.fsf@mid.bfk.de
* Darren Duncan:

> Florian Weimer wrote:
>> Is there are ready-to-use transaction wrapper for DBD:Pg?  I'm looking
>> for somehting which can be used like this:
>
> Oh, absolutely there is.
>
> See http://search.cpan.org/dist/DBIx-Connector/ which David Wheeler
> put out a few years ago.  See the txn() method.
>
> Besides doing exactly what you want (it also does the
> begin_work/commit for you), DBIx::Connector also makes it easier to
> write things that behave correctly in different contexts such as
> persisting DBI connections in Apache versus non-persisting ones in
> scripts.  And it is DBMS-portable.
>
> The module takes care of just a small number of things that are tricky
> to get right and that most people don't want to have to do themselves,
> and it otherwise stays out of your way.

Interesting, thanks.  It just retries once, and always with a new
connection.  It's simpler than what I had in mind.  I'm not sure if it
covers most of our server restart scenarios.

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About