Supported SQL data types in OLE automation
The database manager handles type conversion between SQL types and OLE automation types.
The following table summarizes the supported data types and how they are mapped.
| SQL Type | OLE Automation Type | OLE Automation Type Description |
|---|---|---|
| SMALLINT | short | 16-bit signed integer |
| INTEGER | long | 32-bit signed integer |
| REAL | float | 32-bit IEEE floating-point number |
| FLOAT or DOUBLE | double | 64-bit IEEE floating-point number |
| DATE | DATE | 64-bit floating-point fractional number of days since December 30, 1899 |
| TIME | DATE | 64-bit floating-point fractional number of days since December 30, 1899 |
| TIMESTAMP | DATE | 64-bit floating-point fractional number of days since December 30, 1899 |
| CHAR(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| VARCHAR(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| LONG VARCHAR | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| CLOB(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| GRAPHIC(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| VARGRAPHIC(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| LONG GRAPHIC | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| DBCLOB(n) | BSTR | Length-prefixed string as described in the OLE Automation Programmer's Reference. |
| CHAR(n) | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| VARCHAR(n) | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| LONG VARCHAR | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| CHAR(n) FOR BIT DATA | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| VARCHAR(n) FOR BIT DATA | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| LONG VARCHAR FOR BIT DATA | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
| BLOB(n) | SAFEARRAY[unsigned char] | 1-dim Byte() array of 8-bit unsigned data items. (SAFEARRAYs are described in the OLE Automation Programmer's Reference.) |
Data that is passed between the database and OLE automation routines is passed as call by
reference. The following types are not supported:
- SQL types such as BIGINT, DECIMAL, BINARY, VARBINARY, or LOCATORS
- OLE automation types such as Boolean or CURRENCY
Character and graphic data mapped to BSTR is converted from the database code page to the UCS-2 scheme. (UCS-2 is also known as Unicode, IBM code page 13488). Upon return, the data is converted back to the database code page from UCS-2. These conversions occur regardless of the database code page. If these code page conversion tables are not installed, you receive SQLCODE -332 (SQLSTATE 57017).