Re: libpq

Поиск
Список
Период
Сортировка
От Jim Michaels
Тема Re: libpq
Дата
Msg-id 461407.25372.qm@web34306.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: libpq  (Scott Ribe <scott_ribe@killerbytes.com>)
Ответы Re: libpq
Re: libpq
Список pgsql-general
these are straight dll calls as outlined in Using Run-Time Dynamic Linking (Windows)
that's why they look funny.  it is impossible to link VC++ .lib files with mingw(gcc) .a libraries.

yeah, I just found the PQntuples bug myself too, and got the program finished.  thank you for the tips on using libpq, I may still need to implement those. 

I didn't remember seeing anywhere in the docs that you were supposed to check for pqr==NULL, I wish they would document that in PQexec. must be a documentation bug. There is no mention of return values! http://www.postgresql.org/docs/8.4/interactive/libpq-exec.html

still doesn't solve the need for MingW *.a  libraries version of libpq.  I wouldn't have had to rewrite the whole thing for this to work with mingw.  The DLL's are VC++/MinGW compatible, but the .lib files are not.





From: Scott Ribe <scott_ribe@killerbytes.com>
To: Jim Michaels <jmichae3@yahoo.com>; pgsql general <pgsql-general@postgresql.org>
Sent: Sunday, August 9, 2009 9:16:34 AM
Subject: Re: [GENERAL] libpq

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@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice



В списке pgsql-general по дате отправления:

Предыдущее
От: Tim Hart
Дата:
Сообщение: Re: PQstatus does not seem to work
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: libpq