From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Vutharkar Goutham" <goutham4u(at)hotmail(dot)com> |
Cc: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: Select statement error !!!! |
Date: | 2003-09-24 14:06:30 |
Message-ID: | 3583.1064412390@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
"Vutharkar Goutham" <goutham4u(at)hotmail(dot)com> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Vutharkar Goutham | 2003-09-24 14:48:22 | Re: Select statement error !!!! |
Previous Message | Oliver Elphick | 2003-09-24 11:00:49 | Re: Select statement error !!!! |