From: | "Peter Haworth" <pmh(at)edison(dot)ioppublishing(dot)com> |
---|---|
To: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>, greg(at)turnstep(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: DBI driver and transactions |
Date: | 2003-02-04 11:00:24 |
Message-ID: | PGM.20030204110024.25949.2969@edison.ioppublishing.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)edison(dot)ioppublishing(dot)com
Hi, this is Ken. What's the root password?
From | Date | Subject | |
---|---|---|---|
Next Message | Cleiton Luiz Siqueira | 2003-02-04 11:04:18 | Kernel Error |
Previous Message | Richard Huxton | 2003-02-04 09:56:54 | Re: UNION problem |