DataBlade® API data types

To ensure portability across dissimilar computer architectures, the DataBlade® API provides a set of data types, which begin with the mi_ prefix. Most of these data types correspond to common SQL or C-language data types.

Table 1. DataBlade® API, C, and SQL data types

This table lists DataBlade® API data types and corresponding C and SQL data types. The table is divided into parts. The first part lists character data types. The following parts of the table list integer numeric data types, fixed-point numeric data types, floating-point numeric data types, date and time data types, varying-length data types, complex data types, and other data types.

DataBlade® API data type Standard C or ESQL/C data type SQL data type
Character data types:
mi_char C: char CHAR, VARCHAR, IDSSECURITYLABEL,

GLS: NCHAR, NVARCHAR

mi_char1 C: char CHAR(1)
mi_unsigned_char1 C: unsigned char None
mi_wchar (deprecated) C: unsigned two-byte integer None
mi_string C: char * CHAR, VARCHAR,

GLS: NCHAR, NVARCHAR

mi_lvarchar Informix® ESQL/C: lvarchar (though lvarchar is null-terminated and mi_lvarchar is not) LVARCHAR

Within C UDRs: for CHAR, NCHAR, TEXT, VARCHAR, and NVARCHAR arguments and return value

Integer numeric data types:
mi_sint1 C: signed one-byte integer None
mi_int1 C: unsigned one-byte integer, char None
mi_smallint C: signed two-byte integer (short integer on many systems) SMALLINT
mi_unsigned_smallint C: unsigned two-byte integer None
mi_integer C: signed four-byte integer

(long integer on many systems)

INTEGER, SERIAL
mi_unsigned_integer C: unsigned four-byte integer None
mi_int8 C: signed eight-byte integer; Informix® ESQL/C: int8, ifx_int8_t INT8, SERIAL8
mi_unsigned_int8 C: unsigned eight-byte integer; Informix® ESQL/C: int8, ifx_int8_t None
mi_bigint C: unsigned eight-byte integer BIGINT, BIGSERIAL
mi_unsigned_bigint C: unsigned eight-byte integer None
Fixed-point numeric data types:
mi_decimal, mi_numeric Informix® ESQL/C: decimal, dec_t DECIMAL(p,s) (fixed-point)
mi_money Informix® ESQL/C: decimal, dec_t MONEY
Floating-point numeric data types:
mi_decimal Informix® ESQL/C: decimal, dec_t DECIMAL(p) (floating-point)
mi_real C: float SMALLFLOAT, REAL
mi_double_precision C: double FLOAT, DOUBLE PRECISION
Date and time data types:
mi_date C: four-byte integer; Informix® ESQL/C: date DATE
mi_datetime Informix® ESQL/C: datetime, dtime_t DATETIME
mi_interval Informix® ESQL/C: interval, intrvl_t INTERVAL
Varying-length data types:
mi_lvarchar C: void *

Informix® ESQL/C: lvarchar (though lvarchar is null-terminated and mi_lvarchar is not)

LVARCHAR, Opaque types

Within C UDRs: for CHAR, NCHAR, TEXT, VARCHAR, and NVARCHAR arguments and return value

mi_sendrecv C: void * SENDRECV, opaque-type support functions: send, receive
mi_impexp C: void * IMPEXP, opaque-type support functions: import, export
mi_impexpbin C: void * IMPEXPBIN, opaque-type support functions: importbin, exportbin
mi_bitvarying C: void * BITVARYING
Complex data types:
MI_COLLECTION C: void * SET, LIST, MULTISET
MI_ROW C: void * ROW (unnamed row type), Named row type
Other data types:
mi_boolean C: charInformix® ESQL/C: boolean BOOLEAN
mi_pointer C: void * POINTER
MI_LO_HANDLE None CLOB, BLOB

Smart large objects

Important: To make your DataBlade® API module portable, it is recommended that you use the DataBlade® API platform-independent data types (such as mi_integer, mi_smallint, mi_real, mi_boolean, and mi_double_precision) instead of their C-language counterparts. These data types handle the different sizes of numeric values across computer architectures.
Server only: DataBlade API, C, and SQL data types lists the DataBlade® API data types and SQL data types. However, when you pass some of these data types to and from C UDRs, you must pass them as pointers rather than as values. For more information, see Mechanism for passing MI_DATUM values.
The following table shows where you can find information about how DataBlade® API data types correspond to SQL data types.