Search Postgresql Archives

Re: libpq

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

 



On Mon, Aug 10, 2009 at 4:03 PM, Jim Michaels<jmichae3@xxxxxxxxx> wrote:
> 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.

that is not why they look funny...they look funny because you made them so :-).

function pointers mapped at runtime via dynamic linking do  not need
to be wrapped with ().

val = (PQgetvalue)(pgr,index, 0);strcpy(row.firstname    , val);

could be re-written as:
strcpy(row.firstname, PQgetvalue(pgr,index, 0));

...which is still asking for trouble...you're not checking the length
and blindly copying your results into the receiving structure.

Also, you are mixing 'SELECT *' with assumed column positions.  This
is IMO very bad style. either use explicit column list in your select
statement or pull your data from the result using name instead of
position.

Also, use a compiler which tells you about uninitialized variables,
don't top post, and avoid html emails when posting to public lists
:-).

merlin

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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