Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

Fixed or variable-length records

The c-treeDB API API automatically, and transparently, handles the details of fixed and variable-length records. A table is set to variable-length if it has at least one variable-length field. A fixed-length field always consumes the same amount of disk space in a table file, regardless of what is actually stored in that field. A variable-length field, on the other hand, consumes an amount of disk space that varies with the field's contents.

Variable-length fields require more housekeeping than fixed-length fields. Fortunately, c-treeDB API does this for you. c-treeDB API scans the user field definitions until it encounters the first variable-length field. If a table contains no variable-length fields, the record is set to fixed-length.

c-treeDB API also automatically calculates the size of the fixed portion of a record by adding the size of the fixed-length fields, taking into consideration the field alignment in the record buffer, until the first variable-length field is encountered. The variable-length fields are listed below, with the matching FairCom DB ISAM data type in parentheses:

CT_PSTRING (CT_PSTRING)

CT_VARBINARY (CT_2STRING)

CT_LVB (CT_4STRING)

CT_VARCHAR or CT_LVC (CT_STRING)

Any type of field can be placed anywhere in the record buffer and also be used as an index segment. c-treeDB API makes full use of this feature by providing the user with an advanced dynamic record buffer management.

TOCIndex