Example of creating a support function

This example describes the SQL statement that registers the Union support function with the database server. The example is based on the objects of the sample DataBlade® module, described in Shapes3 sample DataBlade module.

The SQL statements to register the Size, Inter, SFCbits, ObjectLength, SFCvalue, and SetUnion support functions with the database server are similar to the SQL statement to register the Union function.

The following SQL statement shows how to register the Union support function with the database server:
CREATE FUNCTION Union (MyShape, MyShape, MyShape)
RETURNS INTEGER
WITH
(
    NOT VARIANT
)
EXTERNAL NAME "$INFORMIXDIR/extend/shapes.3.0/shapes.bld (MyShapeUnion)"
LANGUAGE C;

The three parameters of the function are all of data type MyShape. The C function MyShapeUnion, found in the shared object file $INFORMIXDIR/extend/Shapes.3.6/Shapes.bld, contains the actual C code that calculates the union of two objects of type MyShape.

For the sample C code of the MyShapeUnion function, see Union support function. C code uses the DataBlade API to interact with the database server. Sample C code to implement the Size and Inter functions is also provided in that appendix.

For more information about the DataBlade API, refer to the Informix® DataBlade API Programmer's Guide.

For more information and examples about how to create user-defined functions, refer to Informix User-Defined Routines and Data Types Developer's Guide.