SQL to C: Numeric
The numeric HCL Informix® ODBC Driver SQL data types are SQL_DECIMAL, SQL_DOUBLE, SQL_INTEGER, SQL_REAL, and SQL_SMALLINT
The following table shows the HCL Informix
ODBC Driver C
data types to which numeric SQL data can be converted.
fCType | Test | rgbValue | pcbValue | SQLSTATE |
---|---|---|---|---|
SQL_C_BINARY | Length of data ≤ cbValueMax. | Data | Length of data | N/A |
Length of data > cbValueMax. | Untouched | Untouched | 22003 | |
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 | Display size < cbValueMax | Data | Length of data | N/A |
Number of whole (as opposed to fractional) digits < cbValueMax. | Truncated data | Length of data | 01004 | |
Number of whole (as opposed to fractional) digits ≥ cbValueMax. | Untouched | Untouched | 22003 | |
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 number is being converted. (HCL Informix ODBC Driver ignores the value of cbValueMax for this conversion. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.) |
Untouched | Untouched | 22003 | |
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. (HCL Informix ODBC Driver ignores the value of cbValueMax for this conversion. HCL Informix ODBC Driver uses the size of rgbValue for the size of the C data type.) |
Untouched | Untouched | 22003 |