From: | Kelly Burkhart <pgkrb(at)kkcsm(dot)net> |
---|---|
To: | pgsql-odbc(at)postgresql(dot)org |
Subject: | 32-bit ints on 64-bit linux |
Date: | 2005-03-01 23:17:33 |
Message-ID: | 4224F80D.2080103@kkcsm.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
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;
How should this be fixed? Should SQL_C_LONG/SQL_C_SLONG be identified
with the native C long of the compiler? On Linux/GCC long is 64 bits.
On Windows 64, I believe a long will remain 32 bits.
It seems nicer to me to reserve SQL_C_LONG/SLONG for 32 bit ints and use
SQL_C_SBIGINT/SQL_C_UBIGINT for 64 bit ints.
An alternative approach would be to use:
ipdopts->parameters[param_number].column_size
to select an appropriate sprintf.
What do you ODBC experts consider an appropriate approach.
-K
From | Date | Subject | |
---|---|---|---|
Next Message | Din Adrian | 2005-03-02 08:53:45 | Re: Using pg_dump through odbc |
Previous Message | anthony.caduto | 2005-03-01 17:46:18 | Re: Using pg_dump through odbc |