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.
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 HCL® Informix® DataBlade® API Programmer's Guide.
For more information and examples about how to create user-defined functions, refer to HCL® Informix® User-Defined Routines and Data Types Developer's Guide.