Bug #28887 SQLBIGINT is assumed to be a long long
Submitted: 4 Jun 2007 22:27 Modified: 13 Mar 2014 11:05
Reporter: Jim Winstead Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.2 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: 64-bit, SQLBIGINT

[4 Jun 2007 22:27] Jim Winstead
Description:
sql_get_data() in results.c assumes that SQLBIGINT is typedef'd to a longlong. this is not always true.

How to repeat:
compile on a platform where unixodbc thinks there is no long long available, and try to assign something to a SQLBIGINT -- you won't be able to, because it's a struct.

this may happen on more platforms than it should, because the unixodbc sqltypes.h checks if HAVE_LONG_LONG is defined regardless of how the driver was compiled.

Suggested fix:
we can detect unixodbc's SQLBIGINT-as-struct with the following trickery:

#if defined(UODBCINT64) && SIZEOF_LONG_INT != 8 && !defined(HAVE_LONG_LONG)
# define SQLBIGINT_IS_A_STRUCT
#endif

then it is just a matter of writing the SQLBIGINT_IS_A_STRUCT code paths in the driver, and writing some tests.
[4 Dec 2007 18:28] Jim Winstead
Documentation for how this structure may look is here:
    http://msdn2.microsoft.com/en-us/library/ms714121.asp