Choose data types for host variables
When you access a database column in your Informix® ESQL/C program, you must declare a host variable of the appropriate C or Informix® ESQL/C data type to hold the data. Corresponding SQL and host variable data types lists the SQL data types of the HCL Informix® and the corresponding Informix® ESQL/C data types that you can declare for host-variables. Corresponding SQL and host variable data types specific to HCL Informix lists the additional SQL data types available with Informix® and the Informix® ESQL/C data types that you can use as host variables for those types of columns. Both figures include a reference to the section or chapter in this book where you can obtain more information about the host-variable data type. For more information about the SQL data types that you can assign to database columns, see the Informix® Guide to SQL: Reference.
SQL data type | ESQL/C predefined data type | C language type | See |
---|---|---|---|
BIGINT | BIGINT | 8-byte integer | Numeric data types |
BIGSERIAL | BIGINT | 8-byte integer | Numeric data types |
BOOLEAN | boolean | SQL data types and ESQL/C header files that are specific to HCL Informix | |
BYTE | ifx_loc_t or loc_t | Simple large objects | |
CHAR(n) CHARACTER(n) |
fixchar [n] or string [n+1] | char [n + 1] or char * | Character and string data types |
DATE | date | 4-byte integer | Time data types |
DATETIME | datetime or dtime_t | Time data types | |
DECIMAL DEC NUMERIC MONEY |
decimal or dec_t | Numeric data types | |
FLOAT DOUBLE PRECISION |
double | Time data types | |
INT8 | int8 or ifx_int8_t | Numeric data types | |
INTEGER INT |
4-byte integer | Numeric data types | |
INTERVAL | interval or intrvl_t | Time data types | |
LVARCHAR | lvarchar | char [n + 1] or char * | Character and string data types |
NCHAR(n) | fixchar [n] or string [n+1] | char [n + 1] or char * | Character and string data types |
NVARCHAR(m) | varchar[m+1] or string [m+1] | char [m+1] | Character and string data types |
SERIAL | 4-byte integer | Numeric data types | |
SERIAL8 | int8 or ifx_int8_t | Numeric data types | |
SMALLFLOAT REAL |
float | Numeric data types | |
SMALLINT | 2-byte integer | Numeric data types | |
TEXT | loc_t | Simple large objects | |
VARCHAR(m,x) | varchar[m+1] or string [m+1] | char d[m+1] | Character and string data types |
SQL data type | ESQL/C predefined data type | See |
---|---|---|
BLOB | ifx_lo_t | Smart large objects |
CLOB | ifx_lo_t | Smart large objects |
LIST(e) | collection | Smart large objects |
MULTISET(e) | collection | Complex data types |
Opaque data type | lvarchar, fixed binary, or var binary | Opaque data types |
ROW(...) | row | Complex data types |
SET(e) | collection | Complex data types |