To register user-defined purpose functions with the database server, issue a CREATE FUNCTION statement for each one.
By convention, you package access-method functions in a DataBlade module. Install the software in $INFORMIXDIR/extend/DataBlade_name for UNIX or %INFORMIXDIR%\extend\DataBlade_name for Windows.
For example, assume you create an open_virtual function that has a table descriptor as its only argument, as the following declaration shows:
mi_integer open_virtual(MI_AM_TAB_DESC *)
Because the database server always passes descriptors by reference as generic pointers to the access method, you register the purpose functions with an argument of type pointer for each descriptor. The following example registers the function open_virtual() function on a UNIX system. The path suggests that the function belongs to a DataBlade module named amBlade.
CREATE FUNCTION open_virtual(pointer)
RETURNING integer
[ WITH (PARALLELIZABLE)]
EXTERNAL NAME
'$INFORMIXDIR/extend/amBlade/my_virtual.bld(open_virtual)'
LANGUAGE C
The PARALLELIZABLE routine modifier indicates that you have designed the function to execute safely in parallel. Parallel execution can dramatically speed the throughput of data. By itself, the routine modifier does not guarantee parallel processing. For more information about parallel execution of functions that belong to an access method, refer to Executing in Parallel.
For the complete syntax of the CREATE FUNCTION statement, refer to the IBM Informix: Guide to SQL Syntax. For information about privileges, refer to the GRANT statement in the IBM Informix: Guide to SQL Syntax.