Re: Perl and AutoCommit

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Madison Kelly <linux(at)alteeve(dot)com>
Cc: postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Perl and AutoCommit
Date: 2005-03-27 10:36:16
Message-ID: 1111919776.1995.32.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2005-03-27 at 00:31 -0500, Madison Kelly wrote:

> What I thought would work was:
>
> $DB->begin_work() || die...
> # a lot of transactions
> $DB->commit() || die...
>

maybe a more complete testcase would be in order.

gnari(at)gnari:~/test $ cat trans.pl
use DBI;
our $dbh = DBI->connect('dbi:Pg:dbname=test') or die 'no database';
$dbh->do('create table transtest(a text)');
$dbh->begin_work() or die 'error in begin';
$dbh->do("insert into transtest values ('foo')");
$dbh->do("insert into transtest values ('bar')");
$dbh->commit() or die 'error in commit' ;
system("psql -d test -c 'select * from transtest;'")

gnari(at)gnari:~/test $ perl trans.pl
a
-----
foo
bar
(2 rows)

gnari(at)gnari:~/test $

gnari(at)gnari:~/test $ perl -v

This is perl, v5.8.4 built for x86_64-linux-thread-multi

gnari(at)gnari:~/test $ perl -MDBI -le 'print $DBI::VERSION'
1.42
gnari(at)gnari:~/test $

perhaps a database operation is failing between your begin_work()
and your commit() ?

gnari

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jaqui Greenlees 2005-03-27 12:36:08 major delays in list....
Previous Message Stephan Szabo 2005-03-27 10:14:49 Re: Debugging deadlocks