C to SQL: Character
The character HCL OneDB™ ODBC Driver C data type is SQL_C_CHAR.
fSqlType | Test | SQLSTATE |
---|---|---|
SQL_BIGINT | Data converted without truncation. | N/A |
Data converted with truncation of fractional digits. | 01004 | |
Conversion of data would result in loss of whole (as opposed to fractional) digits. | 22003 | |
Data value is not a numeric-literal. | 22005 | |
SQL_BIT | Data is 0 or 1. | N/A |
Data is greater than 0, less than 2, and not equal to 1. | 01004 | |
Data is less than 0 or greater than or equal to 2. | 22003 | |
Data is not a numeric-literal. | 22005 | |
SQL_CHAR SQL_LONGVARCHAR SQL_VARCHAR |
Length of data < Column length. | N/A |
Length of data > Column length. | 01004 | |
SQL_DATE | Data value is a valid HCL OneDB ODBC driver date-literal. | N/A |
Data value is a valid HCL OneDB ODBC driver timestamp-literal; time portion is zero. | N/A | |
Data value is a valid HCL OneDB ODBC driver timestamp-literal; time portion is non-zero. HCL OneDB ODBC driver truncates the time portion of the time stamp. | 01004 | |
Data value is not a valid HCL OneDB ODBC driver date-literal or HCL OneDB ODBC driver timestamp-literal. | 22008 | |
SQL_DECIMAL SQL_INTEGER SQL_SMALLINT |
Data converted without truncation. | N/A |
Data converted with truncation of fractional digits. | 01004 | |
Conversion of data would result in loss of whole (as opposed to fractional) digits. | 22003 | |
Data value is not a numeric-literal. | 22005 | |
SQL_DOUBLE SQL_REAL |
Data is within the range of the data type to which the number is being converted. | N/A |
Data is outside the range of the data type to which the number is being converted. | 22003 | |
Data value is not a numeric-literal. | 22005 | |
SQL_LONGVARBINARY | (Length of data) / 2 < Column length. | N/A |
(Length of data) / 2 > Column length. | 01004 | |
Data value is not a hexadecimal value. | 22005 | |
SQL_TIMESTAMP | Data value is a valid HCL OneDB ODBC driver timestamp-literal; fractional seconds portion not truncated. | N/A |
Data value is a valid HCL OneDB ODBC driver timestamp-literal; fractional seconds portion truncated. | 01004 | |
Data value is a valid HCL OneDB ODBC driver date-literal. HCL OneDB ODBC driver sets the time portion of the time stamp to zero. | N/A | |
Data value is a valid HCL OneDB ODBC driver time-literal. HCL OneDB ODBC driver sets the date portion of the time stamp to the current date. | N/A | |
Data value is not a valid HCL OneDB ODBC driver date-literal, HCL OneDB ODBC driver time-literal, or HCL OneDB ODBC driver timestamp-literal. | 22008 |
When HCL OneDB ODBC Driver converts character C data to numeric, date, or time stamp SQL data, it ignores leading and trailing blanks. When HCL OneDB ODBC Driver converts character C data to binary SQL data, it converts each two bytes of character data to one byte of binary data. Each two bytes of character data represent a number in hexadecimal form. For example, HCL OneDB ODBC Driver converts “01” to binary 00000001 and “FF” to binary 11111111.
HCL OneDB ODBC Driver always converts pairs of hexadecimal digits to individual bytes and ignores the null-termination byte. Because of this conversion, if the length of the character string is odd, the last byte of the string (excluding the null termination byte, if any) is not converted.