Re: Perl and AutoCommit
| От | Ragnar Hafstað |
|---|---|
| Тема | Re: Perl and AutoCommit |
| Дата | |
| Msg-id | 1111919776.1995.32.camel@localhost.localdomain обсуждение исходный текст |
| Ответ на | Perl and AutoCommit (Madison Kelly <linux@alteeve.com>) |
| Список | 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@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@gnari:~/test $ perl trans.pl
a
-----
foo
bar
(2 rows)
gnari@gnari:~/test $
gnari@gnari:~/test $ perl -v
This is perl, v5.8.4 built for x86_64-linux-thread-multi
gnari@gnari:~/test $ perl -MDBI -le 'print $DBI::VERSION'
1.42
gnari@gnari:~/test $
perhaps a database operation is failing between your begin_work()
and your commit() ?
gnari
В списке pgsql-general по дате отправления: