IBM Books

Call Level Interface Guide and Reference

Converting Timestamp SQL Data to C Data

The timestamp SQL data type is:

SQL_TIMESTAMP

Table 207. Converting Timestamp SQL Data to C Data
fCType Test rgbValue pcbValue SQLSTATE
SQL_C_CHAR Display size < cbValueMax Data Length of data 00000
19 <= cbValueMax <= Display size Truncated Data b Length of data 01004
cbValueMax < 19 Untouched Length of data 22003
SQL_C_DATE None a Truncated data c 6 e 01004
SQL_C_TIME None a Truncated data d 6 e 01004
SQL_C_TIMESTAMP None a Data 16 e 00000
Note:
a
The value of cbValueMax is ignored for this conversion. The driver assumes that the size of rgbValue is the size of the C data type.
b
The fractional seconds of the timestamp are truncated.
c
The time portion of the timestamp is deleted.
d
The date portion of the timestamp is deleted.
e
This is the size of the corresponding C data type.

SQLSTATE 00000 is not returned by SQLError(), rather it is indicated when the function returns SQL_SUCCESS.

When the timestamp SQL data type is converted to the character C data type, the resulting string is in the "yyyy-mm-dd hh:mm:ss[.fff[fff]]" format (regardless of the precision of the timestamp SQL data type).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]