Received: from clubserv.rp-online.de (clubserv.rp-online.de [149.221.232.11]) by hub.org (8.9.2/8.9.1) with ESMTP id BAA89706 for ; Tue, 9 Mar 1999 01:07:00 -0500 (EST) (envelope-from Michael.Meskes@gmx.net) Received: from pc63.meskes.de (as11-asy82.rp-plus.de [149.221.93.210]) by clubserv.rp-online.de (8.9.1a/8.9.1) with ESMTP id HAA12291 for ; Tue, 9 Mar 1999 07:06:26 +0100 (MET) Received: (from meskes@localhost) by pc63.meskes.de (8.9.3/8.9.3/Debian/GNU) id UAA02012 for pgsql-interfaces@postgreSQL.org; Mon, 8 Mar 1999 20:34:42 +0100 Date: Mon, 8 Mar 1999 20:34:42 +0100 From: Michael Meskes To: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] Counting updates with libpq Message-ID: <19990308203442.A2003@gmx.net> Mail-Followup-To: pgsql-interfaces@postgreSQL.org References: <19990308084647.C227@gmx.net> <6485.920908058@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <6485.920908058@sss.pgh.pa.us>; from Tom Lane on Mon, Mar 08, 1999 at 10:47:38AM -0500 On Mon, Mar 08, 1999 at 10:47:38AM -0500, Tom Lane wrote: > No, I'm afraid *you* are incorrect: a test program like > > res = PQexec(conn, "INSERT INTO test SELECT * FROM test"); > if (PQresultStatus(res) != PGRES_COMMAND_OK) > { > fprintf(stderr, "INSERT command failed\n"); > PQclear(res); > exit_nicely(conn); > } > > printf("INSERT result PQntuples = %d\n", PQntuples(res)); > printf("INSERT result PQcmdTuples = %s\n", PQcmdTuples(res)); > > produces the expected results (ntuples = 0, cmdTuples = number of > inserted rows) for either variant of INSERT. Strange. Have to check my code again. ... Argh! I'm stupid. I just checked via pattern matching and found only the position where the return value was PGRES_TUPLES_OK. In this case I use PQntuples(). If the result was PGRES_COMMAND_OK I do use PQcmdTuples. So I guess that explains it. :-) Michael -- Michael Meskes | Go SF 49ers! Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire! Tel.: (+49) 2431/72651 | Use Debian GNU/Linux! Email: Michael.Meskes@gmx.net | Use PostgreSQL!