Re: libpq

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: libpq
Дата
Msg-id b42b73150908101317p60c42c51x3a52866fa86ae2b1@mail.gmail.com
обсуждение исходный текст
Ответ на Re: libpq  (Jim Michaels <jmichae3@yahoo.com>)
Список pgsql-general
On Mon, Aug 10, 2009 at 4:03 PM, Jim Michaels<jmichae3@yahoo.com> 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

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

Предыдущее
От: Jim Michaels
Дата:
Сообщение: Re: libpq
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Postgres memory question