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.

About this task

To create a row:

Procedure

  1. Call mi_tab_rowdesc() to retrieve the row descriptor.
  2. Call the appropriate DataBlade® API 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 Informix® DataBlade API Programmer's Guide.

  3. If necessary, convert external data types to types that the database server recognizes.
  4. Set the value of the columns that the query does not need to NULL.
  5. Call the DataBlade API mi_row_create() function to create a row from the converted source data.

What to do next

Tip: The mi_row_create() function can affect performance because it requires database server resources. Use it only if you set the am_keyscan purpose flag for the access method.

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 Informix DataBlade API Programmer's Guide.