public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Vutharkar Goutham <[email protected]>
Cc: [email protected]
Subject: Re: Select statement error !!!!
Date: Wed, 24 Sep 2003 10:06:30 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
"Vutharkar Goutham" <[email protected]> writes:
> strcpy(query,"Select * from Udp_Table");
> res = PQexec(conn,query);
> if(!res || PQresultStatus(res)! = PGRES_COMMAND_OK)
> {
> fprintf(stderr,"Select Failed.\n");
The result status from a successful SELECT will be PGRES_TUPLES_OK;
PGRES_COMMAND_OK is only used for commands that do not return a tuple
set.
As commented nearby, it's not real clear that this query is succeeding,
anyway. It would behoove you to print something more useful than
"Select Failed" in your failure path ... see PQresStatus() and
PQresultErrorMessage() for starters.
regards, tom lane
PS: this does not belong on pgsql-docs. pgsql-novice would be an
appropriate forum for first-time questions.
view thread (5+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Select statement error !!!!
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox