The mi_fp_funcstate() function

The mi_fp_funcstate() accessor function obtains user-state information for the user-defined routine from its associated MI_FPARAM structure.

Syntax

void *mi_fp_funcstate(fparam_ptr)
   MI_FPARAM *fparam_ptr;
fparam_ptr
A pointer to the associated MI_FPARAM structure.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_fp_funcstate() function obtains a pointer to the user-state information for the user-defined routine that is associated with the fparam_ptr MI_FPARAM structure. In the first invocation of the UDR, the database server sets the user-state pointer to NULL. Use the mi_fp_funcstate() function to return the user-state pointer so that you can access the state information within a UDR.

Cast this user-state pointer to match the structure of the user-defined buffer. For example, the following call to mi_fp_funcstate() casts the user-state pointer as a structure called udr_info and uses this pointer to access the count_fld of the udr_info structure:
MI_FPARAM *my_fparam;
struct udr_info *fi_ptr;
mi_integer count;
...
fi_ptr = (udr_info *)mi_fp_funcstate( my_fparam );
count = fi_ptr->count_fld;

For more information about UDR information in an MI_FPARAM structure, see the Informix® DataBlade® API Programmer's Guide.

Return values

A user-state pointer
A pointer that references the user-state information in a user-defined buffer. Cast this pointer to match the structure of the user-state information.
NULL
The user-state pointer is uninitialized. The user-state pointer has a NULL value the first time a UDR is invoked.