FairCom Corporation


4.3.5 ctdbAddSegment


Add a new index segment

Declaration

CTHANDLE ctdbAddSegment(CTHANDLE Handle, CTHANDLE FieldHandle,
CTSEG_MODE SegMode)

Description

ctdbAddSegment adds a new index segment, given the index handle. 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 or ctdbAddSegmentByNbr to add a segment given the index number.Use ctdbAddSegmentEx to add a new extended index segment, that may use just part of the field as the index segment. Use ctdbInsSegment to insert a segment in a specified position. Use ctdbDelSegment to delete a segment from an index.

ctdbAddSegment 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

ctdbAddSegment returns the segment handle on success, or NULL on failure.

Example

pMyField1 = ctdbAddField(pMyTable, "Name", CT_FSTRING,32);
pMyField2 = ctdbAddField(pMyTable, "Balance", CT_SFLOAT, 4);
pMyIndex = ctdbAddIndex(pMyTable, "iName", CTINDEX_FIXED,NO,NO);
pMyIseg = ctdbAddSegment(pMyIndex, pMyField1, CTSEG_USCHSEG);
RetVal = ctdbCreateTable(pMyTable,"Table1",CTCREATE_NORMAL);

See also

ctdbAllocSegment, ctdbAddSegmentByName, ctdbAddSegmentByNbr, ctdbAddSegmentEx, ctdbInsSegment, ctdbCreateTable, ctdbAlterTable


FairCom Corporation
www.faircom.com