From: | greg(at)turnstep(dot)com |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: DBI driver and transactions |
Date: | 2003-02-03 14:15:29 |
Message-ID: | 8c57f32fbc49613858db7e564b49e7e3@biglumber.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-----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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200302030912
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iD8DBQE+PnomvJuQZxSWSsgRAhTMAKDLEzXWlGdEQJWKZ72qafkkBL9PRQCfVuh3
uFGqo2u41jwQFONCT9VBAks=
=axjF
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-02-03 14:21:07 | Re: commit errors |
Previous Message | paul butler | 2003-02-03 14:13:47 | Re: Creation of VIEWS not working.... THANKS :-) |