X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 54C04DAE28 for ; Tue, 25 Oct 2005 14:04:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69193-07 for ; Tue, 25 Oct 2005 17:04:43 +0000 (GMT) Received: from mail.e9.com (mail.e9.com [207.191.32.146]) by svr1.postgresql.org (Postfix) with ESMTP id 5ABC7DAD9F for ; Tue, 25 Oct 2005 14:04:41 -0300 (ADT) Received: from [127.0.0.1] ([199.242.210.55]) by mail.e9.com (Kerio MailServer 6.1.0) for pgsql-interfaces@postgresql.org; Tue, 25 Oct 2005 12:04:36 -0500 Message-ID: <435E65A1.7030907@e9.com> Date: Tue, 25 Oct 2005 12:04:33 -0500 From: Louis Castoria User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: libpq status question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/27 X-Sequence-Number: 5789 I'm confused about something and need some help. I wrote a c routine that uses libpq. The result codes are good when I use a select or insert. if I use an update sql command string like "update largetable set t01='update1', t02='update2' where mainkey='12'" and the mainkey of 12 does not exist the result code is a 0 if the mainkey exists I get a result of 0. How can I tell if the update was successfully or not. Here is the code. void pgsql_exec_query( int *dbhandle, char *query, int *qryhandle, int *status ) { char *r,*n=query; int nfields, i, j; PGconn *conn = (PGconn *)*dbhandle; PGresult *res; while ( *n != ';' || *(n+1) != ';' ) n++; *n=0; res = 0; res = PQexec(conn, query); printf("Result = %d ", (int) res); *status = PQresultStatus(res); printf("status = %f", (int) status); *qryhandle = (int) res; }