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 invokes a UDR) |
Destructor | Routine manager (when it exits a UDR) |
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 | Checking Routine Arguments |
Obtain or set information about each return value, such as data type and whether it is NULL | Accessing 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 | Obtaining Other Routine Information |
The UDR can then use the DataBlade API accessor functions that Table 61, Table 62, and Table 64 list to access values in the MI_FPARAM structure.
A UDR can also allocate an MI_FPARAM structure for a UDR that it invokes with the Fastpath interface. For more information, see Using a User-Allocated MI_FPARAM Structure.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]