Access MI_FPARAM routine-state information

When the routine manager calls a UDR, it passes the routine-state information as an extra argument, called the function-parameter structure, to the routine. This function-parameter structure, MI_FPARAM, holds the routine-state information for the C UDR with which it is associated.

This MI_FPARAM structure that the routine manager passes lasts for the duration of an SQL command (subquery execution). The following table summarizes the memory operations for an MI_FPARAM structure.
Memory duration Memory operation Function name
PER_COMMAND Constructor Routine manager (when it starts a UDR)

mi_fparam_allocate(), mi_fparam_copy()

Destructor Routine manager (when it exits a UDR)

mi_fparam_free()

Most UDRs do not need to access this routine-state information. For such routines, you do not have to include an MI_FPARAM structure as a parameter in the C declaration. Your UDR needs to declare an MI_FPARAM parameter only if it needs to perform one of the following tasks.
Task More information
Obtain information about each routine argument, such as data type and whether it is NULL Check routine arguments
Obtain or set information about each return value, such as data type and whether it is NULL Access return-value information
Maintain user-state information between invocations of the routine for the duration of a single SQL statement Saving a user state
Obtain information about the routine itself, such as the routine identifier and iterator information Obtain additional routine information
Tip: When you declare an MI_FPARAM parameter, this declaration must be the last parameter in the C declaration of your UDR. For more information, see The MI_FPARAM argument.
The UDR can then use the DataBlade® API accessor functions that Argument information in an MI_FPARAM structure, Return-value information in the MI_FPARAM structure, and Other routine information in the MI_FPARAM structure list to access values in the MI_FPARAM structure.
Restriction: The MI_FPARAM structure is an opaque C structure to DataBlade® API modules. Do not access its internal fields directly. The internal structure of MI_FPARAM might change in future releases. Therefore, to create portable code, always use the accessor functions for this structure to obtain and store values.

A UDR can also allocate an MI_FPARAM structure for a UDR that it invokes with the Fastpath interface. For more information, see A user-allocated MI_FPARAM structure.