The mi_fp_argisnull() function

The mi_fp_argisnull() accessor function determines whether the argument of a user-defined routine is an SQL NULL value from its associated MI_FPARAM structure.

Syntax

mi_unsigned_char1 mi_fp_argisnull(fparam_ptr, arg_pos)
   MI_FPARAM *fparam_ptr;
   mi_integer arg_pos;
fparam_ptr
A pointer to the associated MI_FPARAM structure.
arg_pos
The index position into the null-argument array for the argument to check for a NULL value.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_fp_argisnull() function determines whether the routine argument at position arg_pos in the MI_FPARAM structure that fparam_ptr references contains the SQL NULL value. The MI_FPARAM structure stores information about whether routine arguments contain the NULL value in the zero-based null-argument array. Therefore, to obtain information about the nth argument, use an arg_pos value of n-1. For example, the following call to mi_fp_argisnull() determines whether the third argument of the my_func() UDR is NULL:
mi_integer my_func(..., fparam1)
   ...
   MI_FPARAM *fparam1;
{
   ...
   if ( mi_fp_argisnull(fparam1, 2) == MI_TRUE )
      /* code to handle NULL argument */

Routines that handle NULL arguments must be registered with the HANDLESNULLS routine modifier of the CREATE FUNCTION or CREATE PROCEDURE statement.

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

Return values

MI_TRUE
The argument at position arg_pos is NULL.
MI_FALSE
The argument at position arg_pos is not NULL.
MI_ERROR
The function was not successful.