After you create all the required support and strategy functions, you are ready to create the operator class.
The following syntax creates an operator class for use with the R-tree access method:
CREATE OPCLASS opclass FOR RTREE STRATEGIES (strategy, strategy, strategy, strategy [, strategy]) SUPPORT (support, support, support {, support, support, support, support {,support}} );
The FOR RTREE clause indicates to the database server that the operator class is for use with the R-tree access method.
The parameters are described in the following table.
Arguments | Purpose | Restrictions |
---|---|---|
opclass | The name you want to give your operator class | The name must be unique in the database. |
strategy | The names of the strategy functions you previously created Four strategy functions are required; any others are optional. | You can list a maximum of 64 functions. You must include the following four strategy functions: Overlap, Equal, Contains, and Within. You can name them whatever you choose, but they must be listed as the first, second, third, and fourth functions, respectively. |
support | The names of the three required support functions you previously created; the four support functions for bulk-loading are optional. The support function RtreeInfo is also optional but must be in the eighth position if specified. | You must include the following three support functions: Union, Size, and Inter. You can name them whatever you choose, but they must be listed as the first, second, and third functions, respectively. You can optionally include the four bulk-loading support functions: SFCbits, ObjectLength, SFCvalue, and SetUnion. You can name them whatever you choose, but they must be listed as the fourth, fifth, sixth, and seventh functions, respectively. If you do not specify the four optional bulk-loading support functions and you do specify RtreeInfo, put NULL in positions four, five, six, and seven. |
If you use the DBDK to create an operator class, you do not have to create the SQL statements to register the support and strategy functions with the database server because the DBDK automatically generates the necessary scripts. However, the DBDK does not automatically generate the SQL statement to create an operator class. Instead, you must create custom SQL files from BladeSmith by choosing Edit > Insert > SQL Files.
The following example shows how to create the MyShape_ops1 operator class:
CREATE OPCLASS MyShape_ops1 FOR RTREE STRATEGIES (Overlap, Equal, Contains, Within) SUPPORT (Union, Size, Inter);
The strategy functions are called Overlap, Equal, Contains, and Within. The support functions are called Union, Size, and Inter.
The following example shows how to create an operator class that also supports bulk loading:
CREATE OPCLASS MyShape_ops2 FOR RTREE STRATEGIES (Overlap, Equal, Contains, Within) SUPPORT (Union, Size, Inter, SFCbits, ObjectLength, SFCvalue, SetUnion);
Note the additional optional bulk-loading support functions SFCbits, ObjectLength, SFCvalue, and SetUnion.
The following example shows how to create an operator class that does not support bulk loading but does include the RtreeInfo support function:
CREATE OPCLASS MyShape_ops3 FOR RTREE STRATEGIES (Overlap, Equal, Contains, Within) SUPPORT (Union, Size, Inter, NULL, NULL, NULL, NULL, RtreeInfo);
For more information on the CREATE OPCLASS statement, refer to the IBM Informix: Guide to SQL Syntax.
For more information on the DBDK and BladeSmith, refer to the IBM Informix: DataBlade Developer's Kit User's Guide.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]