The SFCbits function

The R-tree secondary access method uses the SFCbits function to determine the number of bits required by the internal space-filling curve (SFC) algorithm to represent the spatial key. An example of a space-filling curve is the Hilbert function.

The SFCbits 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 SFCbits support function must be:
SFCbits (UDT, 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 SFCbits function for a variable length UDT is:
mi_integer SFCbits(mi_lvarchar *object, mi_integer *bits)

Write the SFCbits function to return, in the second parameter, the number of bits required to build a spatial key on the data type you want to index. This value must be either 32 or 64.

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

For sample C code of the SFCbits function, see SFCbits support function. C code uses the DataBlade API to interact with the database server.