Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbInsSegmentByName

Insert a segment before the segment indicated by SegNumber, given the field name.

Declaration

CTHANDLE ctdbInsSegmentByName(CTHANDLE Handle, NINT IndexNbr, NINT SegNumber,

pTEXT FieldName, CTSEG_MODE SegMode)

Description

ctdbInsSegmentByName() inserts a new segment index before the segment indicated by SegNumber, given the index number and the field name. 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().

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

  • Handle [in] the Table Handle.
  • IndexNbr [in] the Index number.
  • SegNumber [in] the segment before which the new segment will be inserted.
  • FieldName [in] the Field name.
  • SegMode [in] the Index segment mode. The valid values for the segment modes are: CTSEG_SCHSEG, CTSEG_USCHSEG, CTSEG_VSCHSEG, CTSEG_UVSCHSEG, CTSEG_SCHSRL, described in FairCom DB API definitions. If used with a different segment mode, this call will return error 4047, meaning invalid segment mode. ctdbInsSegmentEx() accepts any segment mode.

Returns

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

Example


pMyNewIseg = ctdbInsSegmentByNbr(pMyTable,0,0,Balance,CTSEG_ REGSEG);

RetVal = ctdbAlterTable(pMyTable, 0);

See also

ctdbInsSegment(), ctdbInsSegmentByNbr(), ctdbInsSegmentEx()

TOCIndex