pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: greg@turnstep.com
To: pgsql-general@postgresql.org
Subject: Re: DBI driver and transactions
Date: Mon,  3 Feb 2003 14:15:29 -0000
Message-ID: <8c57f32fbc49613858db7e564b49e7e3@biglumber.com> (raw)
In-Reply-To: <5.1.0.14.1.20030203182438.02cec830@mbox.jaring.my>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Yep before you disconnect/quit, you're supposed to finish active 
> statements. e.g. prepare, execute, use up results, or call finish if you 
> don't need the rest of the results.

Exactly. The error only appears after you have done a prepare *and* a 
select, with no concomitant finish or fetching. Here is a code sample:

use DBI;

my $dbh = DBI->connect("dbi:Pg:dbname=foobar", $user, $pass,
         {AutoCommit=>0, RaiseError=>1, PrintError=>0});

my $sth = $dbh->prepare("SELECT * FROM baz WHERE waldo > ?");

my $count = $sth->execute(120);

## Exiting here will cause the warning described

if ($count eq "0E0") {
  $sth->finish();
}
else {
  my $info = $sth->fetchall_arrayref({});
  ## Do something with info...
}

## Exiting is now safe: commit and disconnect are separate issues...


- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200302030912

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+PnomvJuQZxSWSsgRAhTMAKDLEzXWlGdEQJWKZ72qafkkBL9PRQCfVuh3
uFGqo2u41jwQFONCT9VBAks=
=axjF
-----END PGP SIGNATURE-----





view thread (16+ messages)  latest in thread

Message-ID: <8c57f32fbc49613858db7e564b49e7e3@biglumber.com>
Permalink:  ../8c57f32fbc49613858db7e564b49e7e3@biglumber.com/
Also on:    postgresql.org/message-id/8c57f32fbc49613858db7e564b49e7e3@biglumber.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: greg@turnstep.com
  Subject: Re: DBI driver and transactions
  In-Reply-To: <8c57f32fbc49613858db7e564b49e7e3@biglumber.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox