Number of updated rows with LibPQ

Поиск
Список
Период
Сортировка
От Dominique Devienne
Тема Number of updated rows with LibPQ
Дата
Msg-id CAFCRh-_Z+ox_W4+yZTOC31d39b7w23jWStvK0SXV1qfht9tRLQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Number of updated rows with LibPQ  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
Hi,

Is there a way to programmatically now how many rows an UPDATE did update?
I've read about [PQcmdTuples][1], but surely I shouldn't have to parse
that string, no?
For selects, I have [PQnTuples][2], but what to do on INSERT, UPDATE, DELETE?
Parse the result of PQcmdTuples myself??? If so, what's the 0 in the
INSERT below?
Is the output of PQcmdTuples "stable", i.e. "official"? Not locale dependent?

Thanks, --DD

[1]: https://www.postgresql.org/docs/14/libpq-exec.html#LIBPQ-PQCMDTUPLES
[2]: https://www.postgresql.org/docs/14/libpq-exec.html#LIBPQ-PQNTUPLES

postgres=# create table foo (v int);
CREATE TABLE
postgres=# insert into foo values (1), (2), (3);
INSERT 0 3
postgres=# update foo set v = 2*v where v = 2;
UPDATE 1
postgres=# delete from foo where v = 3;
DELETE 1
postgres=# select v from foo where v > 1;
...
(1 row)
postgres=# delete from foo;
DELETE 2
postgres=# drop table foo;
DROP TABLE
postgres=#



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Postgres calendar?
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Number of updated rows with LibPQ