SQL to C: Numeric
The numeric HCL OneDB™ ODBC Driver SQL data types are SQL_DECIMAL, SQL_DOUBLE, SQL_INTEGER, SQL_REAL, and SQL_SMALLINT
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_DOUBLESQL_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 OneDB ODBC Driver ignores the value of cbValueMax for this conversion. HCL OneDB ODBC Driver uses the size of rgbValue for the size of the C data type.) |
Untouched | Untouched | 22003 | |
SQL_C_LONGSQL_C_SHORTSQL_C_SLONGSQL_C_SSHORTSQL_C_STINYINTSQL_C_TINYINTSQL_C_ULONGSQL_C_USHORTSQL_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 OneDB ODBC Driver ignores the value of cbValueMax for this conversion. HCL OneDB ODBC Driver uses the size of rgbValue for the size of the C data type.) |
Untouched | Untouched | 22003 |