SQL to C: Time stamp

The time stamp HCL OneDB™ ODBC Driver SQL data type is SQL_TIMESTAMP.

The following table shows the HCL OneDB ODBC Driver C data types to which time stamp SQL data can be converted.

The HCL OneDB ODBC Driver C data types to which time stamp SQL data can be converted.

fCType Test rgbValue pcbValue SQLSTATE
SQL_C_BINARY Length of data < cbValueMax. Data Length of data N/A
Length of data > cbValueMax. Untouched Untouched 22003
SQL_C_CHAR cbValueMax > Display size. Data Length of data N/A
20 < cbValueMax < Display size. Truncated data

(HCL OneDB ODBC Driver truncates the fractional seconds portion of the time stamp.)

Length of data 01004
cbValueMax < 20. Untouched Untouched 22003
SQL_C_DATE Time portion of time stamp is zero. Data 6 N/A
Time portion of time stamp is nonzero.

(HCL OneDB ODBC Driver ignores the value of cbValueMax for this conversion. HCL OneDB ODBC Driver uses the size of rgbValue for the size of the C data type.)

Truncated data

(HCL OneDB ODBC Driver truncates the time portion of the time stamp.)

6

(The size of the corresponding C data type is 6.)

01004
SQL_C_TIMESTAMP Fractional seconds portion of time stamp is not truncated. Data 16 N/A
Fractional seconds portion of time stamp is truncated.

(HCL OneDB ODBC Driver ignores the value of cbValueMax for this conversion. HCL OneDB ODBC Driver uses the size of rgbValue for the size of the C data type.)

Truncated data

(HCL OneDB ODBC Driver truncates the fractional seconds portion of the time stamp.)

16

(The size of the corresponding C data type is 16.)

01004

When HCL OneDB ODBC Driver converts time stamp SQL data to character C data, the resulting string is in the yyyy-mm-dd hh:mm:ss[.f...] format, where up to nine digits can be used for fractional seconds. Except for the decimal point and fractional seconds, the entire format must be used, regardless of the precision of the time stamp SQL data type.