Home | Previous Page | Next Page   Function Descriptions >

mi_fp_retscale( )

The mi_fp_retscale( ) accessor function obtains the scale of a return value of a user-defined function from its associated MI_FPARAM structure.

Syntax

mi_integer mi_fp_retscale(fparam_ptr, ret_pos)
   MI_FPARAM *fparam_ptr;
   mi_integer ret_pos;
fparam_ptr
is a pointer to the associated MI_FPARAM structure.
ret_pos
is the index position into the return-scale array for the return value whose scale you want. For user-defined functions, the only valid value is 0.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
Yes Yes

Usage

The mi_fp_retscale( ) function obtains the scale of the routine return value at position ret_pos from the MI_FPARAM structure that fparam_ptr references. The scale is an attribute of the return-value data type. The meaning of the scale depends on the associated data type, as the following table shows.

Data Type
Meaning of Scale
DECIMAL (fixed-point),
MONEY
The number of digits to the right of the decimal point
DECIMAL
(floating-point)
The value 255
DATETIME,
INTERVAL
The encoded integer value for the end qualifier of the data type; end_qual in the qualifier:

start_qual TO end_qual

If you call mi_fp_retscale( ) on some other data type, the function returns zero (0).

The MI_FPARAM structure stores information about the scale of function return values in the zero-based return-scale array. To obtain information about the nth return value, use a ret_pos value of n-1. For example, the following call to mi_fp_retscale( ) obtains the scale for the first return value of the my_func( ) user-defined function, with which fparam1 is associated:

mi_integer my_func(..., fparam1)
   ...
   MI_FPARAM *fparam1;
{
   mi_integer ret_scale;
   ...
   ret_scale = mi_fp_retscale(fparam1, 0);

Important:
C user-defined functions always have only one return value.

Return Values

>=0
is the scale, in number of digits, of the fixed-point or floating-point return value at position ret_pos.
MI_ERROR
indicates that the function was not successful.

Related Topics

See also the descriptions of mi_fp_argscale( ), mi_fp_retlen( ), mi_fp_retprec( ), mi_fp_rettype( ), mi_fp_returnisnull( ), mi_fp_setargscale( ), and mi_fp_setretscale( ).

For more information about return-value information in an MI_FPARAM structure or about the scale of a fixed-point data type, see the IBM Informix: DataBlade API Programmer's Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]