SQL to C: Timestamp
SQL_TYPE_TIMESTAMP
The following table shows the ODBC C data types to which timestamp SQL data
may be converted. For an explanation of the columns and terms in the table, see
C type identifier |
Test |
*TargetValuePtr | *StrLen_or
_IndPtr | SQL-
STATE |
SQL_C_CHAR | BufferLength > Character byte length
20 <= BufferLength <= Character byte length BufferLength < 20 | Data
Truncated data [b] Undefined | Length of data in bytes
Length of data in bytes 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_DATE | Time portion of timestamp is zero [a]
Time portion of timestamp is non-zero [a] | Data
Truncated data [c] | 6 [f]
6 [f] | n/a
01S07 |
SQL_C_TYPE_TIME | Fractional seconds portion of timestamp is zero [a]
Fractional seconds portion of timestamp is non-zero [a] | Data [d]
Truncated data [d], [e] | 6 [f]
6 [f] | n/a
01S07 |
SQL_C_TYPE_ TIMESTAMP | Fractional seconds portion of timestamp is not truncated [a]
Fractional seconds portion of timestamp is truncated [a] | Data [e]
Truncated data [e] | 16 [f]
16 [f] | n/a
01S07 |
[a] 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. [b] The fractional seconds of the timestamp are truncated. [c] The time portion of the timestamp is truncated. [d] The date portion of the timestamp is ignored. [e] The fractional seconds portion of the timestamp is truncated. [f] This is the size of the corresponding C data type. |
|
|
|