Type descriptors

A type descriptor, MI_TYPE_DESC, is a DataBlade® API data type structure that contains information about an SQL data type. For built-in data types, this information comes from the syscolumns table. For extended data types, it contains the information in the sysxtdtypes table.

The following table lists the DataBlade API accessor functions that obtain information from a type descriptor.

Table 1. Data type information in a type descriptor
Data type information DataBlade API accessor function
The alignment, in number of bytes, of the data type mi_type_align()
Whether a value of the data type is passed by reference or passed by value mi_type_byvalue()
A type descriptor for the element type of a collection data type mi_type_element_typedesc()
The full name (owner.type_name) of the data type mi_type_full_name()
The length of the data type mi_type_length()
The maximum length of the data type mi_type_maxlength()
The owner of the data type mi_type_owner()
The precision (total number of digits) of the data type mi_type_precision()
The qualifier of a DATETIME or INTERVAL data type mi_type_qualifier()
The scale of a data type mi_type_scale()
The short name (no owner) of the data type mi_type_typedesc()
The type identifier for the data type mi_typedesc_typeid()
Restriction: To a DataBlade API module, the type descriptor (MI_TYPE_DESC) is an opaque C data structure. Do not access its internal fields directly. The internal structure of MI_TYPE_DESC might change in future releases. Therefore, to create portable code, always use the accessor functions in Data type information in a type descriptor to obtain values from this structure.
The DataBlade API uses type descriptors in the following situations.
Type descriptor usage More information
To indicate a column type in a row descriptor Description of mi_column_typedesc() in the Informix® DataBlade API Function Reference

Obtain column information

To obtain the source type of a distinct type Description of mi_get_type_source_type() in the Informix DataBlade API Function Reference
To process returned row data, especially when not all the rows returned by a query have the same size and structure Description of mi_get_row_desc_from_type_desc() in the Informix DataBlade API Function Reference
To identify a cast function by the source and target data types to generate its function descriptor Description of mi_td_cast_get() in the Informix DataBlade API Function Reference

Look up cast functions