Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.2/8.9.1) with ESMTP id LAA00694; Sun, 7 Mar 1999 11:21:10 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id LAA21239; Sun, 7 Mar 1999 11:20:39 -0500 (EST) To: Michael Meskes cc: pgsql-interfaces@postgresql.org Subject: Re: [INTERFACES] Counting updates with libpq In-reply-to: Your message of Sat, 6 Mar 1999 13:54:32 +0100 <19990306135432.A1858@gmx.net> Date: Sun, 07 Mar 1999 11:20:39 -0500 Message-ID: <21236.920823639@sss.pgh.pa.us> From: Tom Lane Michael Meskes 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