From: Peter Haworth <pmh@edison.ioppublishing.com>
To: Nigel J. Andrews <nandrews@investsystems.co.uk>
To: greg@turnstep.com
Cc: pgsql-general@postgresql.org
Subject: Re: DBI driver and transactions
Date: Tue, 4 Feb 2003 11:00:24 +0000
Message-ID: <PGM.20030204110024.25949.2969@edison.ioppublishing.com> (raw)
References: <Pine.LNX.4.21.0302031441150.20150-100000@ponder.fairway2k.co.uk>
On Mon, 3 Feb 2003 14:49:39 +0000 (GMT), Nigel J. Andrews wrote:
> I presume that the issue here is that in the 1 or 0 rows returned case
> where 1 row indicates I have a problem then I am not fetching from or
> finishing that statement. Although, in the debugger I've seen the Active
> flag still set after doing a single fetch on a 1 row resultset.
The problem is that the statement doesn't get marked inactive until you have
fetched the row after the last one:
# There are some rows to fetch here
$sth1->execute; # Active
...
$sth1->fetch; # Last row returned, still active
$sth1->fetch; # undef returned, now it's inactive
# No rows to fetch in this case
$sth0->execute; # Active
$sth0->fetch; # undef returned, now it's inactive
As you can see, this behaviour is necessary in order that empty result sets
can be recognised. Otherwise you'd be fetching on an inactive handle.
--
Peter Haworth pmh@edison.ioppublishing.com
Hi, this is Ken. What's the root password?
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: pmh@edison.ioppublishing.com, nandrews@investsystems.co.uk, greg@turnstep.com
Subject: Re: DBI driver and transactions
In-Reply-To: <PGM.20030204110024.25949.2969@edison.ioppublishing.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