Type identifiers
A type identifier, MI_TYPEID, is a DataBlade API data type structure that identifies a data type uniquely. For extended data types, the type identifier is database-dependent; that is, the same type identifier might identify different data types for different databases.
You can determine the data type that a type identifier
represents with the following DataBlade
API functions.
Type-identifier check | DataBlade API function |
---|---|
Are two type identifiers equal? | mi_typeid_equals() |
Does the type identifier represent a built-in data type? | mi_typeid_is_builtin() |
Does the type identifier represent a collection (SET, MULTISET, LIST) data type? | mi_typeid_is_collection() |
Does the type identifier represent a complex data type (row type or collection)? | mi_typeid_is_complex() |
Does the type identifier represent a distinct data type? | mi_typeid_is_distinct() |
Does the type identifier represent a LIST data type? | mi_typeid_is_list() |
Does the type identifier represent a MULTISET data type? | mi_typeid_is_multiset() |
Does the type identifier represent a row type (named or unnamed)? | mi_typeid_is_row() |
Does the type identifier represent a SET data type? | mi_typeid_is_set() |
Restriction: To a DataBlade
API module,
the type identifier (MI_TYPEID) is an opaque C data structure.
Do not access its internal fields directly. The internal structure
of a type identifier might change in future releases. Therefore, to
create portable code, always use the accessor functions for this structure
to determine data type.
The DataBlade
API uses
type identifiers in the following situations.
Type identifier usage | DataBlade API function | More information |
---|---|---|
To indicate a column type in a row descriptor | mi_column_type_id() | Obtain column information |
To indicate data type of arguments in a user-defined routine (UDR) | mi_fp_argtype(), mi_fp_setargtype() | Determine the data type of UDR arguments |
To indicate data type of return type of a UDR | mi_fp_rettype(), mi_fp_setrettype() | Determine the data type of UDR return values |
To indicate data type of a column with which an input parameter in a prepared statement is associated | mi_parameter_type_id() | Obtain input-parameter information |
To identify a UDR by the data types of its arguments to generate its function descriptor | mi_routine_get_by_typeid() | Look up a UDR |
To identify a cast function by the source and target data types to generate its function descriptor | mi_cast_get() | Look up cast functions |
To identify the element type of a collection | mi_collection_create() | Create a Collection |