7. Understanding ODBC Connectivity : ODBC Programming : Date/Time Columns and Values
 
Share this page                  
Date/Time Columns and Values
Prior to Ingres 9.1, the ODBC Driver supported SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, and SQL_C_TYPE_TIMESTAMP for the Ingres "date" data type. In Ingres 9.1 and later, support was added for ISO date/time data types, including:
Time with local time zone
Time with time zone
Time without time zone
Timestamp with local time zone
Timestamp with time zone
Timestamp without time zone
Ansidate (also known as "ISO" date)
Ingresdate (formerly known as "date")
Year to month interval
Day to second interval
The ODBC driver supports all ISO data types in addition to the legacy "ingresdate" type. The ODBC driver is sensitive to the connection level of the target database, and thus can work seamlessly against pre-Ingres 9.1 installations.
Support for SQL_C_INTERVAL_YEAR_TO_MONTH SQL_INTERVAL_YEAR_TO_MONTH, SQL_C_INTERVAL_DAY_TO_SECOND, SQL_INTERVAL_DAY_TO_SECOND is in Ingres 9.1 and later.
The "precision" argument for SQLBindParameter() is supported for SQL_C_TYPE_TIMESTAMP in Ingres 9.1 and later, since ISO timestamps can be declared with a precision for fractions of a second.
If a date/time column is bound to a string type such as SQL_C_CHAR or SQL_C_WCHAR, Ingres rules regarding II_DATE_FORMAT apply, just as if the dates were handled from the Terminal Monitor or other Ingres utility.
Ingres rules on II_DATE_FORMAT do not apply if:
An ODBC date/time escape sequence is used such as:
{ t 'hh:mm:ss ' }
{ d 'yyyy:mm:dd' }
{ ts 'yyyy:mm:dd hh:mm:ss.fffffffff' }
{ interval 'yy-mm' year to month' }
{interval 'dd hh-mm-ss' day to second' }
ODBC date/time structures are used, such as:
SQL_TIME_STRUCT
SQL_DATE_STRUCT
SQL_TIMESTAMP_STRUCT
SQL_INTERVAL_STRUCT