Обсуждение: eekk tuples ok when there not!
postgres 6-5-1 on linux after calling PgConnection::Exec(const char *query); it returns PGRES_TUPLES_OK even when there is nothing in the table! has anyone else noticed this?? or am i mad again =) +-=-=-=-=-=-=-=-StOo-=-=-=-=-=-=-=-+ Stuart Hodgkinson - Software Engineer Comodo Technology Development
On Fri, 20 Aug 1999, StOo wrote:
>
> postgres 6-5-1 on linux
>
> after calling PgConnection::Exec(const char *query);
> it returns PGRES_TUPLES_OK even when there is nothing in the table!
> has anyone else noticed this?? or am i mad again =)
PGRES_TUPLES_OK, as I've always interpreted it, means that there were no
errors in the query itself...checking for res->ntuples is how to check for
the existence of any data...
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
StOo <stuart@comodo.net> writes:
> after calling PgConnection::Exec(const char *query);
> it returns PGRES_TUPLES_OK even when there is nothing in the table!
Yes. Always has, always will. PGRES_TUPLES_OK means you did a
SELECT and had no error --- it is not an error for the SELECT
to find no matching tuples. You have to look at PQntuples
to find out how many tuples you got back.
regards, tom lane