SQL to C conversion for date data
You can convert the date SQL data type, SQL_TYPE_DATE, to a C data type.
The following table shows information about converting date SQL data to C data.
| fCType | Test | rgbValue | pcbValue | SQLSTATE |
|---|---|---|---|---|
| SQL_C_CHAR | cbValueMax >= 11 | Data | 10 | 000001 |
| cbValueMax < 11 | Untouched | 10 | 22003 | |
| SQL_C_WCHAR | cbValueMax >= 22 | Data | 20 | 000001 |
| cbValueMax < 22 | Untouched | 20 | 22003 | |
| SQL_C_TYPE_DATE | None2 | Data | 64 | 000001 |
| SQL_C_TYPE_TIMESTAMP | None2 | Data3 | 164 | 000001 |
| SQL_C_TYPE_TIMESTAMP_EXT | None2 | Data5 | 204 | 000001 |
| SQL_C_TYPE_TIMESTAMP_EXT_TZ | None2 | Data6 | 244 | 000001 |
| SQL_C_BINARY | Data length <= cbValueMax | Data | Data length (in bytes) | 000001 |
| Data length > cbValueMax | Untouched | Untouched | 22003 | |
| Notes:
|
||||
When the date SQL data type is converted to the character C data type, the resulting string is in the "yyyy-mm-dd” format.