Re: Number of updated rows with LibPQ - Mailing list pgsql-general

From Tom Lane
Subject Re: Number of updated rows with LibPQ
Date
Msg-id 2433846.1664993828@sss.pgh.pa.us
Whole thread Raw
In response to Number of updated rows with LibPQ  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: Number of updated rows with LibPQ
List pgsql-general
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Wed, 2022-10-05 at 16:38 +0200, Dominique Devienne wrote:
>> 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?

> Yes, you have to use PQcmdTuples(), and you have to convert the string to an integer.
> But don't worry: the result will *not* be "INSERT 0 5", it will be just "5", so
> you won't have to parse anything.

Yeah, just applying atoi() or atol() to the result should be enough.

            regards, tom lane



pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: Replication between Master PostgreSQL database version 9.6.1 and Standby/Slave PostgreSQL database version 10.17.
Next
From: Josef Šimánek
Date:
Subject: Re: Postgres calendar?