MI_FUNC_DESC *mi_routine_get(conn, flags, rout_sig) MI_CONNECTION *conn; mi_integer flags; char *rout_sig;
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.
[udr_type] [owner.]udr_name([parm1],...,[parmN])
For more information on the syntax of the rout_sig argument, see the description in the following "Usage" section.
Valid in Client LIBMI Application? | Valid in User-Defined Routine? |
---|---|
Yes | Yes |
The mi_routine_get( ) function obtains 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] [owner.]udr_name([parm1], ..., [parmN])
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 for 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 user name for owner to obtain UDRs of a particular owner. If you specify a NULL-valued pointer for owner, mi_routine_get( ) uses 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.
This function is one of the functions of the Fastpath interface. It is a constructor function for the function descriptor.
To obtain a function descriptor for a UDR, the mi_routine_get( ) function performs the following tasks:
When you pass a public connection descriptor (from mi_open( )), the mi_routine_get( ) 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_routine_get( ) 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.
The following call to mi_routine_get( ) looks for the a_udr( ) user-defined function in a database that is not ANSI compliant:
func_desc = mi_routine_get(conn, 0, "a_udr(integer, integer)");
An ANSI-compliant 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:
func_desc = mi_routine_get(conn, 0, "dexter.a_udr(integer, integer)");
The udr_type part of the routine signature is optional. As the preceding examples show, udr_type defaults to FUNCTION when this part is omitted from the routine signature. If a user-defined procedure and a user-defined function have the same routine name, include udr_type in the rout_sig signature. The following call to mi_routine_get( ) specifies that a_udr( ) is a user-defined function:
func_desc = mi_routine_get(conn, 0, "function a_udr(integer, integer)");
For user-defined procedures, specify the PROCEDURE keyword instead.
Other internal errors raise an exception.
See also the descriptions of mi_cast_get( ), mi_fparam_get( ), mi_func_desc_by_typeid( ), mi_routine_end( ), mi_routine_exec( ), and mi_routine_get_by_typeid( ).