Re: Returns from ExecTuplesOk()

Lists: pgsql-general
From: Paul M Foster <paulf(at)quillandmouse(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Returns from ExecTuplesOk()
Date: 2002-04-22 02:58:10
Message-ID: 20020421225809.A18975@quillandmouse.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I'm confused. In libpq++, it seems that ExecTuplesOk() should return
PGRES_TUPLES_OK if a tuples are returned from the query. Yet I'm getting
PGRES_COMMAND_OK instead. When I then check Tuples(), it returns 1. Am I
missing something?

Paul


From: Paul M Foster <paulf(at)quillandmouse(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Returns from ExecTuplesOk() SOLVED
Date: 2002-04-22 22:31:43
Message-ID: 20020422183143.A10844@quillandmouse.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sun, Apr 21, 2002 at 10:58:10PM -0400, Paul M Foster wrote:

> I'm confused. In libpq++, it seems that ExecTuplesOk() should return
> PGRES_TUPLES_OK if a tuples are returned from the query. Yet I'm getting
> PGRES_COMMAND_OK instead. When I then check Tuples(), it returns 1. Am I
> missing something?
>
> Paul

Okay, I answered this myself.

Apparently, ExecCommandOk() and ExecTuplesOk() return true or false, not
PGRES_* values. Beyond that, there is no other clue about why a query
would fail. The PGRES_* values are only returned by the Exec() function,
which you are discouraged from using, for some reason.

I read this in the docs in the first place, but dismissed it as a
misprint. Duh.

Paul


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Paul M Foster <paulf(at)quillandmouse(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Returns from ExecTuplesOk()
Date: 2002-04-23 20:58:41
Message-ID: 200204232058.g3NKwgT18225@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Paul M Foster wrote:
> I'm confused. In libpq++, it seems that ExecTuplesOk() should return
> PGRES_TUPLES_OK if a tuples are returned from the query. Yet I'm getting
> PGRES_COMMAND_OK instead. When I then check Tuples(), it returns 1. Am I
> missing something?

I am not sure. Does libpq++/examples help?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026