Re: accessing PG using Perl:DBI - Mailing list pgsql-general

From Vivek Khera
Subject Re: accessing PG using Perl:DBI
Date
Msg-id 23652D25-9D2E-441A-8564-9B25A060B9CA@khera.org
Whole thread Raw
In response to accessing PG using Perl:DBI  (Ow Mun Heng <Ow.Mun.Heng@wdc.com>)
List 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.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: why does a system catalog insert/update/delete not fire a trigger?
Next
From: Madison Kelly
Date:
Subject: Select question