Search Postgresql Archives

Re: libpq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Jim Michaels
jmichae3@xxxxxxxxx
http://JesusnJim.com




From: Scott Ribe <scott_ribe@xxxxxxxxxxxxxxx>
To: Jim Michaels <jmichae3@xxxxxxxxx>; pgsql general <pgsql-general@xxxxxxxxxxxxxx>
Sent: Sunday, August 9, 2009 9:16:34 AM
Subject: Re: 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@xxxxxxxxxxxxxxx
http://www.killerbytes.com/
(303) 722-0567 voice




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux