Changes to datetime data types
The ODBC driver supports both ODBC 2.0 and ODBC 3.0 datetime values for input. For output, the ODBC driver determines the value to return based on the setting of the environment attribute.
In ODBC 3.0, the identifiers for date, time, and timestamp
have changed. The
#define directives in the include
file sqlcli1.h are added for the values defined in Table 1 for SQL type mappings and Table 2 for C type mappings. - For input, either ODBC 2.0 or ODBC 3.0 datetime values can be used with the Db2 ODBC 3.0 driver.
- On output, the Db2 ODBC
3.0 driver determines the appropriate value to return based on the
setting of the SQL_ATTR_ODBC_VERSION environment attribute.
- If SQL_ATTR_ODBC_VERSION = SQL_OV_ODBC2, the output datetime values are the ODBC 2.0 values.
- If SQL_ATTR_ODBC_VERSION = SQL_OV_ODBC3, the output datetime values are the ODBC 3.0 values.
The following figures show the corresponding ODBC 2.0 to ODBC 3.0 mappings for SQL type and C type identifiers respectively.
| ODBC 2.0 | ODBC 3.0 |
|---|---|
| SQL_DATE(9) | SQL_TYPE_DATE(91) |
| SQL_TIME(10) | SQL_TYPE_TIME(92) |
| SQL_TIMESTAMP(11) | SQL_TYPE_TIMESTAMP(93) |
| ODBC 2.0 | ODBC 3.0 |
|---|---|
| SQL_C_DATE(9) | SQL_C_TYPE_DATE(91) |
| SQL_C_TIME(10) | SQL_C_TYPE_TIME(92) |
| SQL_C_TIMESTAMP(11) | SQL_C_TYPE_TIMESTAMP(93) |
| SQL_C_TIMESTAMP_EXT | SQL_C_TYPE_TIMESTAMP_EXT |
The datetime data type changes affect the following functions:
SQLBindCol()SQLBindParameter()SQLColAttribute()SQLColumns()SQLDescribeCol()SQLDescribeParam()SQLGetData()SQLGetTypeInfo()SQLProcedureColumns()SQLStatistics()SQLSpecialColumns()