The SFCvalue function

The R-tree secondary access method uses the SFCvalue function to determine the sort values of an array of objects of the data type of the column that is being indexed with an R-tree index.

The SFCvalue support function is optional. If you create it and specify it in the operator class with the other optional support functions, the R-tree secondary access method uses a fast bulk-loading algorithm to initially create an R-tree index. If you have not specified this function in the operator class, then the access method uses a slower method to create R-tree indexes.

The SQL signature of the SFCvalue support function must be:
SFCvalue (UDT, INTEGER, POINTER) RETURNS INTEGER

UDT refers to user-defined type, or the data type you want to index with the R-tree access method.

The sample C signature of the SFCvalue function is:
mi_integer SFCvalue(mi_lvarchar *objects, mi_integer array_size, 
                    void *spatialKey)

Write the SFCvalue function to store an array of mi_lvarchar pointers in the data portion of the first parameter. Each mi_lvarchar pointer points to a data object in the table for which the R-tree access method needs to compute a sort value.

The second parameter is the number of elements in the array.

The third output parameter is an array of either 32-bit or 64-bit values, depending on the number of bits specified in the corresponding SFCbits function. This array stores a spatial key for each data object. The number of elements in this array is always the same as the number of elements in the array of the first parameter. The R-tree secondary access method automatically allocates enough space for the array of the third parameter.

The return value of the SFCvalue function is not used by the R-tree access method. The SFCvalue function should call the mi_db_error_raise() DataBlade® API function to return errors.

For sample C code of the SFCvalue function, see ids_rti_141.html#ids_rti_141. C code uses the DataBlade API to interact with the database server.