pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Doug Homoelle <homoelle@ll.mit.edu>
To: pgsql-interfaces@postgresql.org
Subject: newbie libpq question...
Date: Mon, 08 Nov 2004 17:23:59 -0500
Message-ID: <1099952639.2819.8.camel@> (raw)

I'm trying to use the libpq library for the first time and I'm
experiencing what seems to be a very basic problem.  When I run the
following:

	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.  When I do the exact same "select" query through the psql
interface I get 547 rows and 3 columns.  I've checked that
PQresultStatus = PGRES_TUPLES_OK, so it seems like it completed the
command correctly.  I'm new to postgres and I haven't used C in a long
while so I'm a little rusty there.  Am I missing something obvious?

thanks in advance for any insight,
dh




view thread (8+ messages)  latest in thread

Message-ID: <1099952639.2819.8.camel@>
Permalink:  ../1099952639.2819.8.camel@/
Also on:    postgresql.org/message-id/1099952639.2819.8.camel@

 · 

reply

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: homoelle@ll.mit.edu
  Subject: Re: newbie libpq question...
  In-Reply-To: <1099952639.2819.8.camel@>

* 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