C to SQL: Time
SQL_C_TYPE_TIME
The following table shows the ODBC SQL data types to which time C data may be
converted. For an explanation of the columns and terms in the table, see
SQL type identifier |
Test | SQL-
STATE |
SQL_CHAR SQL_VARCHAR SQL_LONGVARCHAR | Column byte length >= 8.
Column byte length < 8. Data value is not a valid time. | n/a
22001 22008 |
SQL_TYPE_TIME | Data value is a valid time.
Data value is not a valid time. | n/a
22007 |
SQL_TYPE_ TIMESTAMP | Data value is a valid time. [a]
Data value is not a valid time. | n/a
22007 |
[a] The date portion of the timestamp is set to the current date and the fractional seconds portion of the timestamp is set to zero. |
|
|
When time C data is converted to character SQL data, the resulting character data is in the
“hh:mm:ss” format.The driver ignores the length/indicator value when converting data from the time C data type and assumes that the size of the data buffer is the size of the time C data type. The length/indicator value is passed in the StrLen_or_Ind argument in SQLPutData and in the buffer specified with the StrLen_or_IndPtr argument in SQLBindParameter. The data buffer is specified with the DataPtr argument in SQLPutData and the ParameterValuePtr argument in SQLBindParameter.