From: Michael Meskes <meskes@postgreSQL.org>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Counting updates with libpq
Date: Mon, 8 Mar 1999 20:34:42 +0100
Message-ID: <19990308203442.A2003@gmx.net> (raw)
In-Reply-To: <6485.920908058@sss.pgh.pa.us>
References: <19990308084647.C227@gmx.net>
<6485.920908058@sss.pgh.pa.us>
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!
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: meskes@postgreSQL.org
Subject: Re: [INTERFACES] Counting updates with libpq
In-Reply-To: <19990308203442.A2003@gmx.net>
* 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