Register purpose functions

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 on UNIX™ or %INFORMIXDIR%\extend\DataBlade_name on Windows™.

For example, assume that 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 open_virtual() function on a UNIX system. The path suggests that the function belongs to a DataBlade module named amBlade.
Important: You must have the Resource or DBA privilege to use the CREATE FUNCTION statement and the Usage privilege on C to use the LANGUAGE C clause.
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.

Important: The CREATE FUNCTION statement adds a function to a database but not to an access method. To enable the database server to recognize a registered function as a purpose function in an access method, you register the access method.