Article ID: 298678 - Last Review: January 21, 2002 - Revision: 1.0 INFO: ODBC 64-Bit API Changes in MDAC 2.7
This article was previously published under Q298678 SUMMARY
The Open Database Connectivity (ODBC) headers and libraries that ship with the Microsoft Data Access Components (MDAC) 2.7 software development kit (SDK) contain some changes from earlier versions of ODBC to allow programmers to code to the new 64-bit platforms. This article summarizes those changes.
MORE INFORMATION
By ensuring that your code uses the ODBC-defined types listed below, you will be able to compile your code for both 64-bit and 32-bit platforms based on the _WIN64 or WIN32 macros. There are several points of particular importance:
Changes in SQL Data TypesThe following four SQL types are still supported on 32-bit only; they are not defined for 64-bit compiles. These types are no longer used for any parameters in MDAC 2.7; use of these types will cause compiler failures on 64-bit platforms.#ifdef WIN32 typedef SQLULEN SQLROWCOUNT; typedef SQLULEN SQLROWSETSIZE; typedef SQLULEN SQLTRANSID; typedef SQLLEN SQLROWOFFSET; #endif #ifdef _WIN64 typedef UINT64 SQLSETPOSIROW; #else #define SQLSETPOSIROW SQLUSMALLINT #endif #ifdef _WIN64 typedef INT64 SQLLEN; typedef UINT64 SQLULEN; #else #define SQLLEN SQLINTEGER #define SQLULEN SQLUINTEGER #endif #ifdef _WIN64 #define SQL_C_BOOKMARK SQL_C_UBIGINT #else #define SQL_C_BOOKMARK SQL_C_ULONG #endif typedef SQLULEN BOOKMARK; Function Declaration ChangesThe following function signatures have changed for 64-bit programming to accommodate the new types. The items in bold text are the specific parameters that have changed.
Values Returned from ODBC API Calls Through PointersThe following ODBC function calls take as an input parameter a pointer to a buffer in which data is returned from the driver. The context and meaning of the data returned is determined by other input parameters for the functions. In some cases, these methods may now return 64-bit (8-byte integer) values instead of the typical 32-bit (4-byte) integer values. These cases are as follows:SQLColAttribute When the FieldIdentifier parameter has one of the following values, a 64-bit value is returned in *NumericAttribute: SQL_DESC_DISPLAY_SIZE SQL_DESC_LENGTH SQL_DESC_OCTET_LENGTH SQL_DESC_COUNT SQLColAttributes When the fDescType parameter has one of the following values, a 64-bit value is returned in *pfDesc: SQL_COLUMN_DISPLAY_SIZE SQL_COLUMN_LENGTH SQL_COLUMN_COUNT SQLGetConnectAttr When the Attribute parameter has one of the following values, a 64-bit value is returned in Value: SQL_ATTR_QUIET_MODE SQLGetConnectOption When the Attribute parameter has one of the following values, a 64-bit value is returned in Value: SQL_ATTR_QUIET_MODE SQLGetDescField When the FieldIdentifier parameter has one of the following values, a 64-bit value is returned in *ValuePtr: SQL_DESC_ARRAY_SIZE SQLGetDiagField When the DiagIdentifier parameter has one of the following values, a 64-bit value is returned in *DiagInfoPtr: SQL_DIAG_CURSOR_ROW_COUNT SQL_DIAG_ROW_COUNT SQL_DIAG_ROW_NUMBER SQLGetInfo When the InfoType parameter has one of the following values, a 64-bit value is returned in *InfoValuePtr: SQL_DRIVER_HENV SQL_DRIVER_HDBC SQL_DRIVER_HLIB When InfoType has either of the following 2 values *InfoValuePtr is 64-bits on both input and ouput: SQL_DRIVER_HSTMT SQL_DRIVER_HDESC SQLGetStmtAttr When the Attribute parameter has one of the following values, a 64-bit value is returned in *ValuePtr: SQL_ATTR_APP_PARAM_DESC SQL_ATTR_APP_ROW_DESC SQL_ATTR_IMP_PARAM_DESC SQL_ATTR_IMP_ROW_DESC SQL_ATTR_MAX_LENGTH SQL_ATTR_MAX_ROWS SQL_ATTR_PARAM_BIND_OFFSET_PTR SQL_ATTR_ROW_ARRAY_SIZE SQL_ATTR_ROW_BIND_OFFSET_PTR SQL_ATTR_ROW_NUMBER SQL_ATTR_ROWS_FETCHED_PTR SQL_ATTR_KEYSET_SIZE SQLGetStmtOption When the Option parameter has one of the following values, a 64-bit value is returned in *Value: SQL_MAX_LENGTH SQL_MAX_ROWS SQL_ROWSET_SIZE SQL_KEYSET_SIZE SQLSetConnectAttr When the Attribute parameter has one of the following values, a 64-bit value is passed in Value: SQL_ATTR_QUIET_MODE SQLSetConnectOption When the Attribute parameter has one of the following values, a 64-bit value is passed in Value: SQL_ATTR_QUIET_MODE SQLSetDescField When the FieldIdentifier parameter has one of the following values, a 64-bit value is passed in *ValuePtr: SQL_DESC_ARRAY_SIZE SQLSetStmtAttr When the Attribute parameter has one of the following values, a 64-bit value is passed in *ValuePtr: SQL_ATTR_APP_PARAM_DESC SQL_ATTR_APP_ROW_DESC SQL_ATTR_IMP_PARAM_DESC SQL_ATTR_IMP_ROW_DESC SQL_ATTR_MAX_LENGTH SQL_ATTR_MAX_ROWS SQL_ATTR_PARAM_BIND_OFFSET_PTR SQL_ATTR_ROW_ARRAY_SIZE SQL_ATTR_ROW_BIND_OFFSET_PTR SQL_ATTR_ROW_NUMBER SQL_ATTR_ROWS_FETCHED_PTR SQL_ATTR_KEYSET_SIZE SQLSetConnectAttr When the Option parameter has one of the following values, a 64-bit value is passed in *Value: SQL_MAX_LENGTH SQL_MAX_ROWS SQL_ROWSET_SIZE SQL_KEYSET_SIZE REFERENCES
You can obtain the MDAC 2.7 libraries and header files needed to support 64-bit compilation from the Microsoft Platform SDK, which can be installed from the following Microsoft Web site:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm
(http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm)
ODBC applications will need to use the following files:Header Files:
| Other Resources Other Support Sites
CommunityArticle Translations |






















Back to the top