Re: C-Interface Amound of Tupels in Result after COPYout

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: C-Interface Amound of Tupels in Result after COPYout
Дата
Msg-id 4285.1195145782@sss.pgh.pa.us
обсуждение исходный текст
Ответ на C-Interface Amound of Tupels in Result after COPYout  (Bert Horvath <bert.horvath@fh-erfurt.de>)
Список pgsql-interfaces
Bert Horvath <bert.horvath@fh-erfurt.de> writes:
> Small example:

> create table foo(bar integer);
> insert into foo values(1),(2),(3);

>     res = PQexec(conn, "COPY foo TO stdout;");
>     if ( PQresultStatus( res ) == PGRES_COPY_OUT )
>     {
>         printf("RowCount: ");
>         printf("%s\n",PQcmdTuples(res)); // this is NULL
>     ...

Wrong result --- at that point you've only started the COPY, not
completed it, so how would it know how many rows there are?
You need to look at the PGRES_COMMAND_OK result after the COPY.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: C-Interface Amound of Tupels in Result after COPYout
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [pgsql-www] change to interfaces.html