From: tomas@nocrew.org
To: Kelly Burkhart <kelly@kkcsm.net>
Cc: pgsql-odbc@postgresql.org
Subject: Re: 32-bit ints on 64-bit linux
Date: 16 Mar 2005 19:58:53 +0100
Message-ID: <80ll8nifiq.fsf@junk.nocrew.org> (raw)
In-Reply-To: <422727B1.9040104@kkcsm.net>
References: <4224F80D.2080103@kkcsm.net>
<422727B1.9040104@kkcsm.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: tomas@nocrew.org, kelly@kkcsm.net
Subject: Re: 32-bit ints on 64-bit linux
In-Reply-To: <80ll8nifiq.fsf@junk.nocrew.org>
References: <4224F80D.2080103@kkcsm.net> <422727B1.9040104@kkcsm.net> <80ll8nifiq.fsf@junk.nocrew.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox