SQL to C conversion for character data
The character SQL data types that you can convert to C data types are SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR, and SQL_CLOB.
The following table shows information about converting character SQL data to C data.
fCType | Test | rgbValue | pcbValue | SQLSTATE |
---|---|---|---|---|
|
Data length < cbValueMax | Data | Data length (in bytes)1 | 000002 |
Data length >= cbValueMax | Truncated data | Data length (in bytes) | 01004 | |
SQL_C_BINARY | Data length <= cbValueMax | Data | Data length (in bytes) | 000002 |
Data length > cbValueMax | Truncated data | Data length (in bytes) | 01004 | |
|
Data converted without truncation | Data | Data length (in bytes) | 000001 |
Data is not a number | Untouched | Data length (in bytes) | 220053 | |
|
Data converted without truncation3 | Data | Size (in bytes) of the C data type | 000002 |
Data converted with truncation, but without loss of significant digits3 | Data | Size (in bytes) of the C data type | 01004 | |
Conversion of data would result in loss of significant digits3 | Untouched | Size (in bytes) of the C data type | 22003 | |
Data is not a number3 | Untouched | Size (in bytes) of the C data type | 22005 | |
SQL_C_TYPE_DATE | Data value is a valid date3 | Data | 64 | 000002 |
Data value is not a valid date3 | Untouched | 64 | 22008 | |
SQL_C_TYPE_TIME | Data value is a valid time3 | Data | 64 | 000002 |
Data value is not a valid time3 | Untouched | 64 | 22008 | |
SQL_C_TYPE_TIMESTAMP | Data value is a valid timestamp3 | Data | 164 | 000002 |
Data value is not a valid timestamp3 | Untouched | 164 | 22008 | |
SQL_C_TYPE_TIMESTAMP_EXT | Data value is a valid timestamp3 | Data | 204 | 000002 |
Data value is not a valid timestamp3 | Untouched | 204 | 22008 | |
SQL_C_TYPE_TIMESTAMP_EXT_TZ | Data value is a valid timestamp with time zone3 | Data | 244 | 000002 |
Data value is not a valid timestamp with time zone3 | Untouched | 244 | 22008 | |
Data value is a valid timestamp, and time zone fields are not specified3,5 | Untouched | 244 | 000002 | |
Notes:
|