Re: [SQL] Questions about embedded-sql!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Questions about embedded-sql!
Дата
Msg-id 13837.924618930@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Questions about embedded-sql!  ("Anna Langer" <anna_langer@hotmail.com>)
Список pgsql-sql
"Anna Langer" <anna_langer@hotmail.com> writes:
> We are having some problems with writing embedded-sql. We want to
> write like this but it doesn't work. test1 is our table in our
> database.

>   res = PQexec(conn, "select * from test1");
>     if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
>     {
>         fprintf(stderr, "DECLARE CURSOR command failed\n");
>   ...

A successful SELECT query will return status PGRES_TUPLES_OK,
not PGRES_COMMAND_OK.  You probably adapted this code from
an example that was executing a command that cannot return
tuples (DECLARE CURSOR, no doubt?).  PGRES_COMMAND_OK is the
right thing in that case.

You should read the documentation and sample programs
for libpq ...
        regards, tom lane


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

Предыдущее
От: Maarten Boekhold
Дата:
Сообщение: Re: [SQL] Questions about embedded-sql!
Следующее
От: Dirk Lutzebaeck
Дата:
Сообщение: SELECT LIMIT not working with unions?