X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF1CD3A4BB3 for ; Sun, 14 Nov 2004 01:23:52 +0000 (GMT) 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 26174-06 for ; Sun, 14 Nov 2004 01:23:48 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 032A53A4BA8 for ; Sun, 14 Nov 2004 01:23:50 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id iAE1NjYd011915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 13 Nov 2004 18:23:48 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id iAE1Nhgo090083; Sat, 13 Nov 2004 18:23:44 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id iAE1Ngn7090082; Sat, 13 Nov 2004 18:23:42 -0700 (MST) (envelope-from mfuhr) Date: Sat, 13 Nov 2004 18:23:41 -0700 From: Michael Fuhr To: Doug Homoelle Cc: pgsql-interfaces@postgresql.org Subject: Re: newbie libpq question... Message-ID: <20041114012339.GA73251@winnie.fuhr.org> References: <1099952639.2819.8.camel@ > Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1099952639.2819.8.camel@ > X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/23 X-Sequence-Number: 5149 On Mon, Nov 08, 2004 at 05:23:59PM -0500, Doug Homoelle wrote: > > res = PQexec(conn, "select blah blah blah"); > test_int=PQntuples(res); > fprintf(stdout,"number of rows: %f\n",test_int); > test_int=PQnfields(res); > fprintf(stdout,"number of cols: %f\n",test_int); > > where "blah blah blah" is the selection criteria, I get zero rows and > zero columns. You're using floating-point (%f) conversions to print integers; use %d or %i instead. Some compilers have options to warn you of such mistakes -- with gcc, for example, you can use -Wall. -- Michael Fuhr http://www.fuhr.org/~mfuhr/