ctdbInsSegment
Insert a segment before the segment indicated by SegNumber
Declaration
CTHANDLE ctdbInsSegment(CTHANDLE Handle, NINT SegNumber,
CTHANDLE FieldHandle, CTSEG_MODE SegMode)
Description
ctdbInsSegment() inserts a segment before the segment indicated by SegNumber segment, given the index handle. The operation of inserting a segment links the index with the field in the table. In order to insert 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. This function handles the segment handle allocation. Segment handle deallocation is automatically handled by ctdbCloseTable() and ctdbCloseAll().
Use ctdbInsSegmentByName() or ctdbInsSegmentByNbr() to insert a segment given the index number.Use ctdbAddSegment() to add a segment to an index. Use ctdbDelSegment() to delete a segment from an index.
After the segments, indexes, and fields have been defined, the table can be created or altered with ctdbCreateTable() or ctdbAlterTable().
Returns
ctdbInsSegment() returns the new segment handle on success, or NULL on failure.
Example
pMyIndex = ctdbGetIndex(pMyTable, 0); // retrieve first index handle
pMyNewIseg = ctdbInsSegment(pMyIndex, 0, , CTSEG_ UREGSEG);
RetVal = ctdbAlterTable(pMyTable, 0);
See also
ctdbAddSegment(), ctdbDelSegment(), ctdbInsSegmentByName(), ctdbInsSegmentByNbr(), ctdbInsSegmentEx()