DataBlade API Programmer's Manual
Chapter 4: Using the MI_FPARAM Structure
Home
Contents
Index
Master Index
New Book
Checking Arguments and Return Values
Among the state information that the
MI_FPARAM
structure holds about an iterator function is information about the arguments and return values of the function, in particular, whether they have null values and what data types they are.
You can use DataBlade
API
functions to obtain this information about arguments and return values.
Checking Arguments
The following DataBlade
API
functions access information about the arguments of a routine that the
MI_FPARAM
structure describes:
The
mi_fp_nargs()
and
mi_fp_setnargs()
functions access the
fp_nargs
field of
MI_FPARAM
to obtain or set the number of arguments of the routine.
The
mi_fp_argisnull()
and
mi_fp_setargisnull()
functions access the fp_argisnull array of
MI_FPARAM
.
This array contains an element for each argument of the routine. Because it is a zero-based array, it has (
fp_nargs
-1) elements. Each element is either
MI_FALSE
(the argument is not null) or
MI_TRUE
(the argument is null). A null argument means that no value has been passed in for the associated parameter of the routine.
Routines that handle null arguments should be registered with the
HANDLESNULL
routine modifier in the
CREATE FUNCTION
or
CREATE PROCEDURE
statement. For more information, see
Extending INFORMIX-Universal Server: User-Defined Routines
.
The
mi_fp_argtype()
and
mi_fp_setargtype()
functions access the
fp_argtype
array of
MI_FPARAM
.
This array also contains an element for each argument of the routine. Because it is a zero-based array, it has (
fp_nargs
-1) elements. Each element is the integer data-type constant that indicates the data type of the argument. The
sqltypes.h
header file contains defined constants for each of these data-type values.
Checking Return Values
A DataBlade
API
function can only return a single value because it is written in the C language. The following DataBlade
API
functions access information about the return value of a function that the
MI_FPARAM
structure describes:
The
mi_fp_nrets()
and
mi_fp_setnrets()
functions access the
fp_nrets
field of
MI_FPARAM
to obtain or set the number of return values of the function.
For DataBlade functions that are written in C, the
fp_nrets
value is always
1
.
The
mi_fp_returnisnull()
and
mi_fp_setreturnisnull()
functions access the
fp_returnisnull
array of
MI_FPARAM
.
This array contains an element for each return value of the function. Because
fp_returnisnull
is a zero-based array, it has (
fp_nrets
-1) elements. Each element is either
MI_FALSE
(the return value is not null) or
MI_TRUE
(the return value is null). For DataBlade functions written in C, only the
fp_returnisnull[0]
element has a valid value.
The
mi_fp_rettype()
and
mi_fp_setrettype()
functions access the
fp_rettype
array of
MI_FPARAM
.
This array also contains an element for each argument of the routine. Because
fp_rettype
is a zero-based array, it has (
fp_nrets
-1) elements. Each element is the integer data-type constant that indicates the data type of the argument. The
sqltypes.h
header file contains defined constants for each of these data-type values. For DataBlade functions written in C, only the
fp_rettype[0]
element has a valid value.
DataBlade API Programmer's Manual
, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.