Bug #28887 SQLBIGINT is assumed to be a long long
Submitted: 5 Jun 2007 0:27 Modified: 1 Feb 2008 0:16
Reporter: Jim Winstead
Status: To be fixed later
Category:Connector/ODBC Severity:S3 (Non-critical)
Version:5.2 OS:Any
Assigned to: Target Version:5.2
Tags: 64-bit, SQLBIGINT
Triage: D3 (Medium)

[5 Jun 2007 0: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 19:28] Jim Winstead
Documentation for how this structure may look is here:
    http://msdn2.microsoft.com/en-us/library/ms714121.asp