The mi_fp_setrettype() function

The mi_fp_setrettype() accessor function sets the type identifier for the data type of a return value of a user-defined function in its associated MI_FPARAM structure.

Syntax

void mi_fp_setrettype(fparam_ptr, ret_pos, ret_typeid)
   MI_FPARAM *fparam_ptr;
   mi_integer ret_pos;
   MI_TYPEID *ret_typeid;
fparam_ptr
A pointer to the associated MI_FPARAM structure.
ret_pos
The index position into the return-type array for the return value whose type identifier you want to set. For C user-defined functions, the only valid value is 0.
ret_typeid
A pointer to the integer type identifier that specifies the data type to set for the ret_pos + 1 return value.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_fp_setrettype() function sets the type identifier of the function return value at position ret_pos in the MI_FPARAM structure that fparam_ptr references. The type identifier is an integer value that indicates a particular data type. The ret_typeid value must be a valid type identifier. The MI_FPARAM structure stores information about the type identifiers of function return values in the zero-based return-type array.

For more information about return-value information in an MI_FPARAM structure, see the HCL OneDB™ DataBlade® API Programmer's Guide.

To set information about the nth return value, use a ret_pos value of n-1. For example, the following call to mi_fp_setrettype() sets the type identifier to mi_integer for the first return value of the my_func() UDR, with which fparam1 is associated:
mi_integer my_func(..., fparam1)
   ...
   MI_FPARAM *fparam1;
{
   MI_TYPEID *type_id;
   ...
   type_id = mi_typestring_to_id(conn, "integer");
   mi_fp_setrettype(fparam1, 0, type_id);
Important: C user-defined functions always have only one return value.

Return values

None.