The mi_fp_setfuncstate() function

The mi_fp_setfuncstate() accessor function sets the user-state pointer for the user-defined routine in its associated MI_FPARAM structure.

Syntax

void mi_fp_setfuncstate(fparam_ptr, state_ptr)
   MI_FPARAM *fparam_ptr;
   void *state_ptr;
fparam_ptr
The pointer to the associated MI_FPARAM structure.
state_ptr
A pointer to the user-state information that is stored as the user-state pointer.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_fp_setfuncstate() function sets the user-state pointer for the user-defined routine that is associated with the fparam_ptr MI_FPARAM structure. The user-state pointer points to a user-defined buffer or structure that contains private state information for the user-defined routine. 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 private state information within a UDR.

Cast the state_ptr pointer to void * before you store it as the user-state pointer. For example, the following call to mi_fp_setfuncstate() casts a pointer to a structure called udr_info before it stores it as the user-state pointer in an MI_FPARAM structure:
MI_FPARAM *my_fparam;
struct udr_info *fi_ptr;
...
fi_ptr = (udr_info *)mi_dalloc(sizeof(udr_info),
   PER_COMMAND);
mi_fp_setfuncstate(my_fparam, (void *)fi_ptr);

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

Return values

None.