Converting to and from a row format
Before you begin
Before the access method can return row values to a query, the access method must convert source data to data types that database server recognizes, native HCL Informix® data types, and user-defined data types (UDTs). The database server can recognize a UDT because the application registers it in the database with a CREATE TYPE statement.
About this task
Procedure
- Call mi_tab_rowdesc() to retrieve the row descriptor.
- Call the appropriate row-descriptor
accessor functions to obtain the information, such as data type, for
each column.
For a list of available row-descriptor accessor functions, see the description of MI_ROW_DESC in the HCL® Informix® DataBlade® API Programmer's Guide.
- Call mi_scan_nprojs() and mi_scan_projs() to determine which columns the query specifies.
- If necessary, convert external data types to types that the database server recognizes.
- Set the value of the columns that the query does not need to NULL.
- Call the mi_row_create() function to create a row from the converted source data.
What to do next
The database server passes an MI_ROW structure to the am_insert and am_update purpose functions. To extract the values to insert or update, call mi_value() or mi_value_by_name(). For more information about these functions, see the HCL® Informix® DataBlade® API Programmer's Guide.