Skip site navigation (1) Skip section navigation (2)

Re: 32-bit ints on 64-bit linux

From: Kelly Burkhart <kelly(at)kkcsm(dot)net>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: 32-bit ints on 64-bit linux
Date: 2005-03-03 15:05:21
Message-ID: 422727B1.9040104@kkcsm.net (view raw or flat)
Thread:
Lists: pgsql-odbc
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.

-K

Attachment: psqlodbc_convert.patch
Description: text/x-patch (1.9 KB)

In response to

Responses

pgsql-odbc by date

Next:From: jrossDate: 2005-03-04 23:42:30
Subject: Installation problem with psqlodbc-08_00_0100.zip
Previous:From: Theodore PetroskyDate: 2005-03-03 12:50:00
Subject: odbc on Mac OS X

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group