The mi_func_desc_by_typeid() function

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
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().

This value 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
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 compatibility with earlier versions, 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 Informix® DataBlade® API Programmer's Guide.

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.

Return values

An MI_FUNC_DESC pointer
A pointer to the function descriptor for the UDR that routine_id identifies.
NULL
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