SQL to C: Character

The character HCL Informix® ODBC Driver SQL data types are SQL_CHAR, SQL_LONGVARCHAR, and SQL_VARCHAR.

The following table shows the HCL Informix ODBC Driver C data types to which character SQL data can be converted. When HCL Informix ODBC Driver converts character SQL data to numeric, date, or time stamp C data, it ignores leading and trailing spaces.
fCType Test rgbValue pcbValue SQLSTATE
SQL_C_BINARY Length of data ≤ cbValueMax. Data Length of data N/A
Length of data > cbValueMax. Truncated data Length of data 01004
SQL_C_BIT Data is 0 or 1. Data 1 N/A
Data is greater than 0, less than 2, and not equal to 1. Truncated data 1 01004
Data is less than 0 or greater than or equal to 2. Untouched Untouched 22003
Data is not a numeric-literal. Untouched Untouched

(The size of the corresponding C data type is 1.)

22005
SQL_C_CHAR Length of data < cbValueMax. Data Length of data N/A
Length of data ≥ cbValueMax. Truncated data Length of data 01004
SQL_C_DATE Data value is a valid date-value. Data 6 N/A
Data value is a valid timestamp-value; time portion is zero. Data 6 N/A
Data value is a valid timestamp-value; time portion is non-zero.

(HCL Informix ODBC Driver ignores the date portion of timestamp-value.)

Truncated data 6 01004
Data value is not a valid date-value or timestamp-value.

(For all these conversions, HCL Informix ODBC Driver ignores the value of cbValueMax. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.)

Untouched Untouched

(The size of the corresponding C data type is 6.)

22008
SQL_C_DOUBLE
SQL_C_FLOAT
Data is within the range of the data type to which the number is being converted. Data Size of the C data type N/A
Data is outside the range of the data type to which the numb er is being converted. Untouched Untouched 22003
Data is not a numeric-literal.

(For all these conversions, HCL Informix ODBC Driver ignores the value of cbValueMax. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.)

Untouched Untouched 22005
SQL_C_LONG
SQL_C_SHORT
SQL_C_SLONG
SQL_C_SSHORT
SQL_C_STINYINT
SQL_C_TINYINT
SQL_C_ULONG
SQL_C_USHORT
SQL_C_UTINYINT
Data converted without truncation. Data Size of the C data type N/A
Data converted with truncation of fractional digits. Truncated data Size of the C data type 01004
Conversion of data would result in loss of whole (as opposed to fractional) digits. Untouched Untouched 22003
Data is not a numeric-literal.

(For all these conversions, HCL Informix ODBC Driver ignores the value of cbValueMax. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.)

Untouched Untouched 22005
SQL_C_TIMESTAMP Data value is a valid time stamp-value; fractional seconds portion not truncated. Data 16 N/A
Data value is a valid timestamp-value; fractional seconds portion truncated. Truncated data 16 N/A
Data value is a valid date-value. Data

(HCL Informix ODBC Driver sets the time fields of the time stamp structure to zero.)

16 N/A
Data value is a valid time-value. Data

(HCL Informix ODBC Driver sets the date fields of the time stamp structure to the current date.)

16 N/A
Data value is not a valid date-value, time-value, or timestamp-value.

(For all these conversions, HCL Informix ODBC Driver ignores the value of cbValueMax. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.)

Untouched Untouched

(The size of the corresponding C data type is 16.)

22008

Copyright© 2020 HCL Technologies Limited