Execute qualification functions
There are alternative ways to process a simple function.
The routine identifier
The
access method uses a DataBlade
API facility
called FastPath to execute registered UDRs that are not in the same
shared-object module as the access-method functions. To use the FastPath
facility, the access method performs the following general steps:
- Calls the mi_qual_funcid() accessor function to obtain the routine identifier.
- Passes the routine identifier to the DataBlade API mi_func_desc_by_typeid() function, which returns the function descriptor.
- Passes the function descriptor to the DataBlade API mi_routine_exec() function.
For
complete information about FastPath functions and the function descriptor
(MI_FUNC_DESC), see the HCL
Informix®
DataBlade API Programmer's Guide.
Tip: You can obtain the function descriptor in the am_beginscan purpose
function, store the function descriptor in the PER_COMMAND user data,
and call mi_scan_setuserdata() to store a pointer
to the user data. In the am_getnext purpose function,
call mi_scan_userdata() to retrieve the pointer,
access the function descriptor, and execute the function with mi_routine_exec().
The function name
To extract the function name from the qualification descriptor, the access method calls the mi_qual_funcname() accessor function.
You
can use mi_qual_funcname() to identify the function
in a qualification, then directly call a local routine that implements
it. For example, if an access method contains a local equal() function,
it might include the following condition:
/* Compare function name to string.*/
if (strcmp("equal", mi_qual_funcname(qd)) == 0)
{ /* Execute equal() locally. */ }
An access method can also use the mi_qual_funcid() function if external software controls the data. The access method uses this and other accessor functions to extract information from the qualification descriptor into a form that the external software can interpret.