Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Insert a new extended index segment before the segment indicated.


CTHANDLE ctdbInsSegmentEx(CTHANDLE Handle, NINT SegNumber, NINT offset,

NINT length, CTSEG_MODE SegMode)


ctdbInsSegmentEx() inserts a new extended index segment before the segment SegNumber. A segment is denominated extended if it is based on the segment offset. This function handles the segment handle allocation. Segment handle deallocation is automatically handled by ctdbCloseTable() and ctdbCloseAll().

After the segments, indexes, and fields have been defined, the table can be created or altered with ctdbCreateTable() or ctdbAlterTable().

  • Handle [in] the index handle.
  • SegNumber [in] the segment number before which we should insert the new segment.
  • offset [in] the absolute byte offset.
  • length [in] the segment length in bytes.
  • SegMode [in] the Index segment mode. The valid values for the segment modes are listed in Section c-treeDB API definitions. Notice that ctdbInsSegmentEx() does work with Absolute byte offset segments.


ctdbInsSegmentEx() returns the segment handle on success, or NULL on failure


pMyIndex = ctdbGetIndex(pMyTable, 0); // retrieve first index handle

pMyNewIseg = ctdbInsSegmentEx(pMyIndex, 0, 32, 4, CTSEG_ UREGSEG);

RetVal = ctdbAlterTable(pMyTable, 0);

See also

ctdbInsSegmentByName(), ctdbInsSegment(), ctdbInsSegmentByNbr(), ctdbAddSegmentEx()