Home | Previous Page | Next Page   Function Descriptions >

mi_func_desc_by_typeid( )

The mi_func_desc_by_typeid( ) function looks up a registered user-defined routine by its routine identifier and creates its function descriptor.

Syntax

MI_FUNC_DESC *mi_func_desc_by_typeid(conn, routine_id)
   MI_CONNECTION *conn;
   mi_funcid *routine_id;;
conn
is a pointer to a connection descriptor established by a previous call to mi_open( ), mi_server_connect( ), or mi_server_reconnect( ).

can be a pointer to a session-duration connection descriptor established by a previous call to mi_get_session_connection( ). Use of a session-duration connection descriptor is an advanced feature of the DataBlade API.

routine_id
is the routine identifier that uniquely identifies the UDR within the sysprocedures system catalog table.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
No Yes

Usage

The mi_func_desc_by_typeid( ) function creates a function descriptor for the UDR that the routine_id argument specifies. The routine_id argument provides the routine identifier of the UDR. The function is one of the functions of the Fastpath interface. It is a constructor function for the function descriptor.

Tip:
The DataBlade API provides the mi_funcid data type to hold routine identifiers. The mi_funcid data type has the same structure as the mi_integer data type. For backward compatibility, some DataBlade API functions still assume that routine identifiers are of type mi_integer.

This function performs the following tasks:

  1. Looks for a user-defined routine that matches the routine_id routine identifier 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 has allocated for the user-defined routine
Server Only

When you pass a public connection descriptor (from mi_open( )), the mi_func_desc_by_typeid( ) function allocates the new function descriptor in the PER_COMMAND memory duration. If you pass a session-duration connection descriptor (from mi_get_session_connection( )), mi_func_desc_by_typeid( ) allocates the new function descriptor in the PER_SESSION memory duration. This function descriptor is called a session-duration function descriptor. For more information, see the IBM Informix: DataBlade API Programmer's Guide.

Warning:
The session-duration connection descriptor and session-duration function descriptor are advanced features of the DataBlade API. They can adversely affect your UDR if you use them incorrectly. Use them only when a regular connection descriptor or function descriptor cannot perform the task you need done.
End of Server Only

Return Values

An MI_FUNC_DESC pointer
is a pointer to the function descriptor for the UDR that routine_id identifies.
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 the following routines:
  • SPL routines that include the WITH RESUME clause in the RETURN statement
  • Iterator functions

Related Topics

See also the descriptions of mi_fparam_get( ), mi_routine_end( ), mi_routine_exec( ), mi_routine_get( ), mi_routine_get_by_typeid( ), and mi_routine_id_get( ).

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