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 B2896DAA57 for ; Wed, 26 Oct 2005 09:46:37 -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 84944-05 for ; Wed, 26 Oct 2005 12:46:32 +0000 (GMT) Received: from mail.e9.com (mail.e9.com [207.191.32.146]) by svr1.postgresql.org (Postfix) with ESMTP id 7AB58DA720 for ; Wed, 26 Oct 2005 09:46:29 -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; Wed, 26 Oct 2005 07:46:33 -0500 Message-ID: <435F7AA7.3060508@e9.com> Date: Wed, 26 Oct 2005 07:46:31 -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: 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/26 X-Sequence-Number: 5788 I'm confused about something and need some help. I wrote a c routine that uses libpq. 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 successful 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; } } -- Louis Castoria - ADSI Software Engineer 1930 First Commercial Drive Southaven MS, 38671 Phone: 662-393-2046 WEB: http://www.e9.com