pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to use $result->ruseltStatus
2+ messages / 2 participants
[nested] [flat]
* how to use $result->ruseltStatus
@ 2001-05-08 02:12 Randall Perry <rgp@systame.com>
0 siblings, 1 reply; 2+ messages in thread
From: Randall Perry @ 2001-05-08 02:12 UTC (permalink / raw)
To: pgsql-interfaces
I want to make sure queries returned aren't empty. Tried this:
$conn = Pg::connectdb("dbname=$db");
$res = $conn->exec("$q");
$result_status = $res->resultStatus;
($result_status != PGRES_EMPTY_QUERY) ? print "query not empty\n" :
print "query empty\n";
But it returns '2' (not sure which constant it is, but it's not
PGRES_EMPTY_QUERY) on empty queries.
What's the right use of this property?
--
Randy Perry
sysTame
Mac Consulting/Sales
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: how to use $result->ruseltStatus
@ 2001-05-08 02:56 Tom Lane <tgl@sss.pgh.pa.us>
parent: Randall Perry <rgp@systame.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2001-05-08 02:56 UTC (permalink / raw)
To: Randall Perry <rgp@systame.com>; +Cc: pgsql-interfaces
Randall Perry <rgp@systame.com> writes:
> I want to make sure queries returned aren't empty.
Check the number of rows returned (after checking for OK
resultStatus).
> But it returns '2' (not sure which constant it is, but it's not
> PGRES_EMPTY_QUERY) on empty queries.
PGRES_EMPTY_QUERY means you sent an empty string as the query, eg
$conn->exec("");
This is pretty useless, and is distinguished only for historical
reasons...
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-08 02:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-08 02:12 how to use $result->ruseltStatus Randall Perry <rgp@systame.com>
2001-05-08 02:56 ` Re: how to use $result->ruseltStatus Tom Lane <tgl@sss.pgh.pa.us>
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