Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Key Value Assembly

FairCom DB stores the key value in the index AFTER requested segments are concatenated and transformed according to the segment mode. For ease of data portability, c-tree stores all numeric key values in High/Low format (MSB, LSB) regardless of the underlying CPU architecture. However, c-tree does not automatically translate your key target buffers in the same way.

It is essential that all target values be transformed prior to key value searches, especially when using numeric segments. For numeric segments, be sure to select the proper segment mode. Segment mode value 1 should be used for unsigned integer and long values, while segment mode value 8 is for signed integers and longs. Floats and doubles should receive segment mode value 9. Any ISAM function that is passed a key target buffer, such as GetRecord(), expects a fully and properly formed key target.

The key target buffer can be manually built using C routines. Be sure to build the key target according to the index and segment definitions. See TransformKey in the function reference section for an example of building a three-segment key target buffer.

After building the key target, call TransformKey() to perform the key value transformations prior to calling the key search function. If you use an extended function call, such as InitISAMXtd(), to initialize c-tree, TransformKey() is automatically called for each ISAM search routine, unless you indicate that you do not want the automatic transformation via the user profile mask.

In This Section