Re: libpq

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: Jim Michaels <jmichae3(at)yahoo(dot)com>, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: libpq
Date: 2009-08-09 16:16:34
Message-ID: C6A45282.BEC31%scott_ribe@killerbytes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

That's pretty confused C code. The most obvious problem is that you're not
calling the Pqntuples function; you're just examining the value of a
variable called ntuples, when you haven't set that value after calling
Pqexec (and maybe have never set it).

Take it step by step, and check error returns at each step--including
connecting to the database, and of course especially check errors after
calling PQexec--first checking that pgr is not null, then if not null using
the PQresultStatus, PQresStatus, PQresultErroMessage functions, otherwise
the PQstatus, PQerrorMessage functions.

Then if you still have problems, post more complete code that includes
important things like connecting to the database, and declarations &
assignments to key variables.

Also, what is this "(function)(args)" stuff? Normally, the PQ functions are
plain C functions, called as "function(args)". Do you really have some setup
where you have function pointer variables and your compiler requires that
outdated syntax? Or is this more basic C confusion?

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 722-0567 voice

In response to

  • libpq at 2009-08-08 21:45:06 from Jim Michaels

Responses

  • Re: libpq at 2009-08-10 20:03:16 from Jim Michaels

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-08-09 16:55:28 Re: Postgres memory question
Previous Message Kobus Wolvaardt 2009-08-09 15:53:44 Postgres memory question