Re: 32-bit ints on 64-bit linux

Поиск
Список
Период
Сортировка
От tomas@nocrew.org (Tomas Skäre)
Тема Re: 32-bit ints on 64-bit linux
Дата
Msg-id 80ll8nifiq.fsf@junk.nocrew.org
обсуждение исходный текст
Ответ на Re: 32-bit ints on 64-bit linux  (Kelly Burkhart <kelly@kkcsm.net>)
Список pgsql-odbc
Kelly Burkhart <kelly@kkcsm.net> writes:

> Replying to my own message...
>
> Kelly Burkhart wrote:
> > Greetings,
> > I am having a problem in running some code in 64 bit unix.  I'm
> > running unixODBC and psqlodbc-08.00.0005 on SuSE 9.1 x86-64.
> > If I bind a 32 bit integer using SQL_INTEGER/SQL_C_LONG and pass a
> > value of -1, the insert fails with an 'integer out of range' error.
> > The reason this happens is the sprintf near line 2658 of convert.c.
> >     case SQL_C_SLONG:
> >     case SQL_C_LONG:
> >         sprintf(param_string, "%ld",
> >                 *((SDWORD *) buffer));
> >         break;
>
> It appears that SQL_C_LONG does correspond to a 32-bit integer and not
> the native long.
>
> I'm attaching a patch which fixes this, and some other questionable
> sprintf format strings in convert.c.

Just a note on this. There are already standardized format string
defines (when including inttypes.h) for different sizes:

PRId8, PRId16, PRId32, PRId64, PRIu8, PRIu16, PRIu32, PRIu64, ...

It may be better to use those. However, I don't know if they are
available in Windows.


Greetings,

Tomas

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

Предыдущее
От: Andy Satori
Дата:
Сообщение: Re: psqlodbc-08.00.0005 + libiodbc-3.52.2 + mac os x
Следующее
От: "Bhabani Sankar Jena"
Дата:
Сообщение: Is there any test code for PostgreSQL-ODBC Driver?