Partager via


OLE DB 64-Bit Information

The OLE DB components that ship with the MDAC 2.8 and later and Windows DAC 6.0 and layter contain some changes from earlier versions of OLE DB to allow programmers to write code for the new 64-bit platforms. This topic summarizes those changes.

Several new typedefs have been defined in the OLE DB header file. These new types allow you to maintain one set of source code for both 32-bit and 64-bit platforms. The simplest way to ensure that code will compile in either 32-bit or 64-bit environments is to make sure that the code uses these new types for variable definitions. For example, suppose your existing code looks like this:

int cCol = 32;
hr = pIColumnsInfo->GetColumnInfo(&cCol, &pColumnInfo, &pStringsBuffer);

Instead of defining the cCol variable as an integer, you should use the new DBORDINAL type, as follows:

DBORDINAL cCol = 32;
hr = pIColumnsInfo->GetColumnInfo(&cCol, &pColumnInfo, &pStringsBuffer);

This code will now compile and run on either a 32-bit or a 64-bit platform.

The following table compares the underlying definition of these new typedefs based on whether or not _WIN64 has been defined.

TYPEDEF Name

WIN32

_WIN64

DBLENGTH

ULONG

ULONGLONG

DBROWOFFSET

LONG

LONGLONG

DBROWCOUNT

LONG

LONGLONG

DBCOUNTITEM

ULONG

ULONGLONG

DBORDINAL

ULONG

ULONGLONG

DB_LORDINAL

LONG

LONGLONG

DBBKMARK

ULONG

ULONGLONG

DBBYTEOFFSET

ULONG

ULONGLONG

DBREFCOUNT

ULONG

ULONG

DB_UPARAMS

ULONG

ULONGLONG

DB_LPARAMS

LONG

LONGLONG

DBHASHVALUE

DWORD

DWORDLONG

DB_DWRESERVE

DWORD

DWORDLONG

DB_LRESERVE

LONG

LONGLONG

DB_URESERVE

ULONG

ULONGLONG