[freetds] ODBC on 64 bit linux fix.
Sebastien FLAESCH
sf at 4js.com
Fri Jan 18 03:19:18 EST 2008
Hi all,
We are about to test our product with FreeTDS on Linux 64b...
In our code we use SQLULEN and SQLLEN (comes from the Windows 64b port experience):
SQLRETURN r;
SQLUSMALLINT pos = i + 1;
SQLSMALLINT namelen;
SQLSMALLINT sqltype;
* SQLULEN precision;
SQLSMALLINT scale;
SQLSMALLINT nullable;
* SQLULEN size;
SQLSMALLINT ctype = 0;
r = SQLDescribeCol(st->stmtHandle, pos, NULL, 0,
&namelen, &sqltype, &precision, &scale, &nullable);
So first I doubt that Christos patch is I good idea:
-SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN FAR * pirow)
+SQLParamOptions(SQLHSTMT hstmt, SQLUINTEGER crow, SQLUINTEGER FAR * pirow)
Changing SQLULEN to SQLUINTEGER in FreeTDS would break the standards... no?
If I understand properly, we should define BUILD_REAL_64_BIT_MODE when
compiling or application code... is this correct?
According to the UnixODBC headers (sqltype.h):
#if (SIZEOF_LONG == 8)
#ifndef BUILD_REAL_64_BIT_MODE
typedef int SQLINTEGER;
typedef unsigned int SQLUINTEGER;
#define SQLLEN SQLINTEGER
#define SQLULEN SQLUINTEGER
#define SQLSETPOSIROW SQLUSMALLINT
typedef SQLULEN SQLROWCOUNT;
typedef SQLULEN SQLROWSETSIZE;
typedef SQLULEN SQLTRANSID;
typedef SQLLEN SQLROWOFFSET;
#else
typedef int SQLINTEGER;
typedef unsigned int SQLUINTEGER;
typedef long SQLLEN;
typedef unsigned long SQLULEN;
typedef unsigned long SQLSETPOSIROW;
...
If we don't define BUILD_REAL_64_BIT_MODE, SQLLEN would be an int4, since
int is 4 bytes on a 64b linux ... right?
Thanks,
Seb
More information about the FreeTDS
mailing list