Re: [INTERFACES] Counting updates with libpq
От | Michael Meskes |
---|---|
Тема | Re: [INTERFACES] Counting updates with libpq |
Дата | |
Msg-id | 19990308203442.A2003@gmx.net обсуждение исходный текст |
Ответ на | Re: [INTERFACES] Counting updates with libpq (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-interfaces |
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!
В списке pgsql-interfaces по дате отправления: