Re: Select statement error !!!!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Select statement error !!!!
Дата
Msg-id 3583.1064412390@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Select statement error !!!!  ("Vutharkar Goutham" <goutham4u@hotmail.com>)
Список pgsql-docs
"Vutharkar Goutham" <goutham4u@hotmail.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.

В списке pgsql-docs по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: Select statement error !!!!
Следующее
От: "Vutharkar Goutham"
Дата:
Сообщение: Re: Select statement error !!!!