Re: accessing PG using Perl:DBI

From: Vivek Khera <vivek(at)khera(dot)org>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: accessing PG using Perl:DBI
Date: 2007-08-30 16:00:26
Message-ID: 23652D25-9D2E-441A-8564-9B25A060B9CA@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Aug 30, 2007, at 4:03 AM, Ow Mun Heng wrote:

> 2. how do I perform a list of SQL using transactions. eg: like above,
> but wrap it into a transaction.

assuming $dbh is your open handle to the database via DBI, then you
do something like this:

$dbh->begin_work() or die;
$sth = $dbh->prepare(...) or die;
$sth->execute(....) or die;

... more queries as needed...

$dbh->commit() or die;

Did you read the DBI manuals at all? It has examples.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Madison Kelly 2007-08-30 16:01:06 Select question
Previous Message Tom Lane 2007-08-30 15:58:07 Re: why does a system catalog insert/update/delete not fire a trigger?