From: Michael Fuhr <mike@fuhr.org>
To: Doug Homoelle <homoelle@ll.mit.edu>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: newbie libpq question...
Date: Sat, 13 Nov 2004 18:23:41 -0700
Message-ID: <20041114012339.GA73251@winnie.fuhr.org> (raw)
In-Reply-To: <1099952639.2819.8.camel@ >
References: <1099952639.2819.8.camel@ >
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: mike@fuhr.org, homoelle@ll.mit.edu
Subject: Re: newbie libpq question...
In-Reply-To: <20041114012339.GA73251@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox