SQL to C conversion for time data

You can convert the time SQL data type, SQL_TYPE_TIME, into a C data type.

The following table shows information about converting time SQL data to C data.

Table 1. Conversion of time SQL data to C data
fCType Test rgbValue pcbValue SQLSTATE
SQL_C_CHAR cbValueMax >= 9 Data 8 000001
cbValueMax < 9 Untouched 8 22003
SQL_C_WCHAR cbValueMax >= 18 Data 16 000001
cbValueMax < 18 Untouched 16 22003
SQL_C_TYPE_TIME None2 Data 63 000001
SQL_C_TYPE_TIMESTAMP None2 Data4 163 000001
Start of changeSQL_C_TYPE_ TIMESTAMP_EXTEnd of change Start of changeNone2End of change Start of changeData5End of change Start of change203End of change Start of change000001End of change
Notes:
  1. SQLSTATE 00000 is not returned by SQLGetDiagRec(), rather it is indicated when the function returns SQL_SUCCESS.
  2. 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.
  3. This is the size of the corresponding C data type.
  4. The date fields of the TIMESTAMP_STRUCT structure are set to the current system date of the machine that the application is running, and the time fraction is set to zero.
  5. The time fields of the TIMESTAMP_STRUCT_EXT structure are set to zero.

When the time SQL data type is converted to the character C data type, the resulting string is in the "hh:mm:ss” format.