Before the consumer creates an accessor, it can call
The
Table: 5.7.9.1.1.
OLE-DB Data Type Mappings
SQL Type Indicator | Indicator of C Type Used For Internal Buffers | OLE DB Type Indicator |
---|---|---|
SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR, SQL_DECIMAL, SQL_NUMERIC | SQL_C_CHAR | DBTYPE_STR |
SQL_BIT | SQL_C_BIT | DBTYPE_BOOL |
SQL_TINYINT, SQL_SMALLINT | SQL_C_USHORT, SQL_C_SSHORTS | DBTYPE_I2 |
SQL_INTEGER | SQL_C_ULONG, SQL_C_SLONG | DBTYPE_I4 |
SQL_BIGINT | SQL_C_STR | DBTYPE_STR |
SQL_REAL | SQL_C_FLOAT | DBTYPE_R4 |
SQL_FLOAT, SQL_DOUBLE | SQL_C_DOUBLE | DBTYPE_R8 |
SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY | SQL_C_BINARY | DBTYPE_BYTES |
SQL_DATE | SQL_C_DATE | DBTYPE_DATE |
SQL_TIME | SQL_C_TIME | DBTYPE_DATE |
SQL_TIMESTAMP | SQL_C_TIMESTAMP | DBTYPE_DATE |
For types DBTYPE_UI1, DBTYPE_I2, DBTYPE_I4, DBTYPE_I8, DBTYPE_R4, DBTYPE_R8, DBTYPE_CY, DBTYPE_NUMERIC, the length binding is always set to the fixed size of the destination binding type, rather than the internal source type.
The follwoing table outlines the supported type conversion implemented in the
Table: 5.7.9.3.1. OLE-DB Data Type Conversions
I1 | I2 | I4 | I8 | UI1 | UI2 | UI4 | UI8 | R4 | R8 | CY | DEC | NUM | BOOL | DATE | DBDATE | DBTIMESTAMP | DBTIME | BYTES | BSTR | STR | WSTR | DISP | UNK | GUID | |
I1 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
I2 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
I4 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
I8 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
UI1 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
UI2 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
UI4 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
UI8 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
R4 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
R8 | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
CY | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
DEC | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
NUM | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | - | - | - | X | X | X | X | - | - | - |
BOOL | - | - | - | - | - | - | - | - | - | - | - | - | - | X | - | - | - | - | X | X | X | X | - | - | - |
DATE | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | X | X | X | X | X | X | X | - | - | - |
DBDATE | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | X | - | X | X | X | X | X | - | - | - |
DBTIME | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | - | X | X | X | X | X | X | - | - | - |
DBTIMESTAMP | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | X | X | X | X | X | X | X | - | - | - |
BYTES | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | - | X | X | X | X | X | X | X | X |
BSTR | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | - | - | X |
STR | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | - | X | X |
WSTR | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | - | X | X |
DISP | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | - | - | - | X | X | - |
UNK | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | - | - | - | - | X | - |
GUID | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | X | X | X | X | - | - | X |