Re: [INTERFACES] Counting updates with libpq

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] Counting updates with libpq
Дата
Msg-id 21236.920823639@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [INTERFACES] Counting updates with libpq  (Michael Meskes <meskes@postgreSQL.org>)
Ответы Re: [INTERFACES] Counting updates with libpq  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-interfaces
Michael Meskes <meskes@postgresql.org> writes:
>>>> Is it possible to get number of updated records using the PQexec command
>>>> and processing the PQresult record?
>>
>> See PQcmdTuples() ...

> For ecpg I've beed using PQntuples(). Is it the same function?

No.  PQntuples() is the number of rows in the returned result.  It will
always be zero if the SQL command was not SELECT (or FETCH).

PQcmdTuples() is just a dumb little function that looks at the command
status string (the same thing psql prints at the end of a query) and
pulls out the number that appears in "UPDATE n" or "DELETE n" or
"INSERT oid n".  Since the questioner asked about updated records,
I assumed that was the number he wanted.

            regards, tom lane

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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: [INTERFACES] Counting updates with libpq
Следующее
От: Nitin Mule
Дата:
Сообщение: DBD::Pg ->Error in 'make test'