informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_routine_get()

The mi_routine_get() function looks up a registered user-defined routine by routine signature that is a character string and returns its function descriptor.

Syntax

Usage

The mi_routine_get() function creates a function descriptor for the UDR that the rout_sig argument specifies. The rout_sig argument specifies the routine signature of the UDR in the following format:


udr_type is the word function (the default) or procedure.
owner is the name of the UDR owner. When the UDR is defined in a database that is not ANSI-compliant, mi_routine_get() looks for UDRs owned only by owner. If you specify a NULL-valued pointer as an owner, mi_routine_get() looks for UDRs owned by anyone. When the UDR is defined in an ANSI-complaint database, owner is part of its routine signature. You can specify a particular owner name to obtain UDRs of a particular owner. If you specify a NULL-valued pointer as an owner, mi_routine_get() assumes the current user account as the owner name. If no UDRs exist for the current user, mi_routine_get() looks for UDRs with user informix as the owner name.
udr_name is the name of the user-defined routine to look up.
parm1,...
parmN
is an optional list of data types for the parameters of the user-defined routine.

This function is one of the functions of the Fastpath interface. It is a constructor function for the function descriptor.

The mi_routine_get() function performs the following tasks:

  1. Looks for a user-defined routine that matches the rout_sig routine signature in the sysprocedures system catalog table.
  2. Allocates a function descriptor for the UDR and saves the routine sequence in this descriptor.
  3. Allocates an MI_FPARAM structure for the routine and saves the argument and return-value information in this structure.
  4. Returns a pointer to the function descriptor that it allocated for the user-defined routine.

The mi_routine_get() function allocates a new function descriptor in the PER_COMMAND memory duration.

The following call to mi_routine_get() looks for the a_udr() user-defined function in a database that is not ANSI compliant:

An ANSI database requires an owner name as part of a routine name. If a_udr() was defined in an ANSI-compliant database, you must include the owner name in the routine signature, as follows:

The udr_type is optional in the routine signature. As the preceding examples show, the udr_type defaults to function when it is omitted from the routine signature. If a user-defined procedure and a user-defined function have the same routine name, include the udr_type in the rout_sig signature. The following call to mi_routine_get() specifies that a_udr() is a user-defined function:

For user-defined procedures, specify the procedure keyword instead.

Return Values

MI_FUNC_DESC * is a pointer to the function descriptor for the routine that rout_sig specifies.
NULL indicates that no matching user-defined routine was found or that the specified user-defined routine has multiple return values, which is possible with:

Other internal errors raise an exception.

Related Topics

See the descriptions of the following functions: mi_cast_get(), mi_fparam_get(), mi_routine_get_by_typeid(), mi_routine_exec(), and mi_routine_end().

For more information, see Calling UDRs with the Fastpath Interface.


Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved