pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Meskes <meskes@postgresql.org>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] Counting updates with libpq
Date: Sun, 07 Mar 1999 11:20:39 -0500
Message-ID: <21236.920823639@sss.pgh.pa.us> (raw)
In-Reply-To: <19990306135432.A1858@gmx.net>

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



view thread (7+ messages)  latest in thread

Message-ID: <21236.920823639@sss.pgh.pa.us>
Permalink:  ../21236.920823639@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21236.920823639@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, meskes@postgresql.org
  Subject: Re: [INTERFACES] Counting updates with libpq
  In-Reply-To: <21236.920823639@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox