The MI_FPARAM argument
The routine manager passes an MI_FPARAM structure into every UDR that it executes. This structure contains routine-state information about the UDR, such as information about arguments and return values. Because the routine manager automatically passes an MI_FPARAM structure to a UDR, you do not need to explicitly declare this structure in most C-function declarations.
- You need to access routine-state information within the UDR.
When you declare an MI_FPARAM parameter, this declaration must be the last parameter in the C declaration of your UDR. For more information about the DataBlade® API functions that access the routine-state information from MI_FPARAM, see Access MI_FPARAM routine-state information.
- You declare a UDR that does not take any arguments.
A C UDR always gets at least one argument: a pointer to the MI_FPARAM structure. When the parameter list of your SQL UDR is empty, you must still include a declaration for the MI_FPARAM structure, even if the UDR does not access routine-state information.
CREATE FUNCTION func_noargs() RETURNS INTEGER
EXTERNAL NAME '/usr/lib/udrs/udrs.so' LANGUAGE C;
mi_integer func_noargs(MI_FPARAM *fparam)
{
...
}