FairCom Corporation


4.3.7 ctdbAddSegmentByNbr


Add a new index segment, given the field and index numbers.

Declaration

CTHANDLE ctdbAddSegmentByNbr(CTHANDLE Handle, NINT IndexNbr,
NINT FieldNbr, CTSEG_MODE SegMode)

Description

ctdbAddSegmentByNbr adds a new index segment, given the index and field numbers. The operation of adding a segment links the index with the field in the table. In order to add a segment with this function, the segment must be defined based on individual full fields, using what is known as record schema. See the c-tree Plus documentation for further information on record schemas.

Use ctdbAddSegmentByName to add a new index segment given its name. Use ctdbAddSegment to add a new index segment given the index handle. Use ctdbAddSegmentEx to add a new extended index segment.

ctdbAddSegmentByNbr does the segment allocation. After the segments, indices, and fields have been defined, the table can be created or altered with ctdbCreateTable or ctdbAlterTable.

Returns

ctdbAddSegmentByNbr returns the segment handle on success, or NULL on failure

Example

ctdbAddField(pMyTable, "Name", CT_FSTRING, 32);
ctdbAddField(pMyTable, "Balance", CT_SFLOAT, 4);
ctdbAddIndex(pMyTable, "iName", CTINDEX_FIXED, NO, NO);
ctdbAddSegmentByNbr(pMyTable, 0, 0, CTSEG_USCHSEG);
RetVal = ctdbCreateTable(pMyTable, "Table1", CTCREATE_NORMAL);

See also

ctdbAddSegment, ctdbAddSegmentEx, ctdbAddSegmentByName


FairCom Corporation
www.faircom.com