Received: from rm-rstar.sfu.ca (root@rm-rstar.sfu.ca [142.58.120.21]) by hub.org (8.9.3/8.9.3) with ESMTP id TAA91491 for ; Wed, 2 Feb 2000 19:54:35 -0500 (EST) (envelope-from blackw@sfu.ca) Received: from sfu.ca (jung.psyc.sfu.ca [142.58.172.8]) by rm-rstar.sfu.ca (8.9.2/8.9.2/SFU-5.0H) with ESMTP id QAA18701 for ; Wed, 2 Feb 2000 16:54:33 -0800 (PST) Message-ID: <3898D1C8.B2FB101B@sfu.ca> Date: Wed, 02 Feb 2000 16:54:32 -0800 From: Richard Reply-To: blackw@sfu.ca X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: ExecCommandOk() return code always zero? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I've got a little test program that I'm playing with, and am finding an unusual behaviour. When I query the database with an ExecCommandOk(), it always returns zero. If I query the database with an ExecTuplesOk(), it always returns 1 (regardless of whether or not there are any records in the database). Here is my little test program: #include #include int main(void); int main() { PgDatabase myDB("host=localhost port=5432 dbname=test"); printf("ExecCommandOk returns: %d\n", myDB.ExecCommandOk("select * from mytable"); printf("ExecTuplesOk return: %d\n", myDB.ExecTuplesOk("select * from mytable"); printf("Database has %d record(s)\n", myDB.Tuples()); return 0; } If I have, say, five records in the database, the result of running this program is: ExecCommandOk returns: 0 ExecTuplesOk returns: 1 Database has 5 record(s) If I purge all the records in the database, the result of running this program is: ExecCommmandOk returns: 0 ExecTuplesOk returns: 1 Database has 0 record(s) Why would ExecCommandOk() and ExecTuplesOk() be returning these consistent values? The docs indicate the ExecCommandOk() should be returning TRUE instead of FALSE, and ExecTuplesOk() should only be returning TRUE if there are tuples to be retreived. Thanks for your insight. Cheers, Richard