The identifier for the time ODBC SQL data type is:
SQL_TYPE_TIME
The following table shows the ODBC C data types to which time SQL data may be converted. For an explanation of the columns and terms in the table, see “Converting Data from SQL to C Data Types.”
C type identifier |
Test |
*TargetValuePtr |
*StrLen_or _IndPtr |
SQL- STATE |
SQL_C_CHAR | BufferLength > Character byte length 9 <= BufferLength <= Character byte length BufferLength < 9 |
Data
Truncated data [a] Undefined |
Length of data in bytes Length of data in bytes Undefined |
n/a
01004 22003 |
SQL_C_WCHAR | BufferLength > Character length 9 <= BufferLength <= Character length BufferLength < 9 |
Data
Truncated data [a] Undefined |
Length of data in characters Length of data in characters Undefined |
n/a
01004 22003 |
SQL_C_BINARY | Byte length of data <= BufferLength Byte length of data > BufferLength |
Data Undefined |
Length of data in bytes Undefined |
n/a 22003 |
SQL_C_TYPE_TIME | None [b] | Data | 6 [d] | n/a |
SQL_C_TYPE_ TIMESTAMP |
None [b] | Data [c] | 16 [d] | n/a |
[a]The fractional seconds of the time are truncated.
[b]The value of BufferLength is ignored for this conversion. The driver assumes that the size of *TargetValuePtr is the size of the C data type.
[c]The date fields of the timestamp structure are set to the current date and the fractional seconds field of the timestamp structure is set to zero.
[d]This is the size of the corresponding C data type.
When time SQL data is converted to character C data, the resulting string is in the “hh:mm:ss” format. This format is not affected by the Windows country setting.