Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

CTSegment.AddSegment

Syntax

CTSegment.AddSegment(CTIndex Index, CTField Field, SEG_MODE SegMode)

CTSegment.AddSegment(CTIndex Index, String FieldName, SEG_MODE SegMode)

CTSegment.AddSegment(CTIndex Index, int FieldNumber, SEG_MODE SegMode)

CTSegment.AddSegment(CTIndex Index, int offset, int Length, SEG_MODE SegMode)

CTSegment.AddSegment(int IndexNbr, int FieldNbr, SEG_MODE SegMode)

CTSegment.AddSegment(int IndexNbr, String FieldName, SEG_MODE SegMode)

CTSegment.AddSegment(int IndexNbr, CTField Field, SEG_MODE SegMode)

CTSegment.AddSegment(String IndexName, String FieldName, SEG_MODE SegMode)

CTSegment.AddSegment(String IndexName, int FieldNumber, SEG_MODE SegMode)

CTSegment.AddSegment(String IndexName, CTField Field, SEG_MODE SegMode)

Parameters

  • Index [in] The index object.
  • Field [in] The field object that composes part of the index segment
  • SegMode [in] The segment mode. The valid values for the segment mode are shown in "Segment Modes". Notice that, if this method is used in the implementation that requires the offset, the segment is called extended, and in this specific case, the segment modes should be those that depend on the offset. If the implementation used is any other, the segment mode should be one of the so called schema segments (SEG_MODE.SCHSEG_SEG, SEG_MODE.USCHSEG_SEG, SEG_MODE.VSCHSEG_SEG, SEG_MODE.UVSCHSEG_SEG, SEG_MODE.SCHSRL_SEG).
  • FieldName [in] Field name to compose the index segment
  • FieldNumber [in] Field number to compose the index segment
  • offset [in] Absolute byte offset of the segment. If used, this offset should be calculated with care, since the hidden fields included by c-tree Plus for .NET should be taken into account: $DELFLD$ (always included, to account for the deleted record) - 4 bytes; $NULFLD$ (always present - 1 bit for every user defined field, rounded for the next byte); ROWID$ (8 bytes to account for the automatic auto-increment record - see the discussion on ROWID() in "Hidden Fields". This variation makes it difficult to predict the correct offset of each user defined offset.
  • Length [in] Segment length in bytes
  • IndexNbr [in] Index number
  • FieldNbr [in] Field number to compose the index segment
  • IndexName [in] Index name to be updated.

Description

Adds a new segment to an index.

It is strongly recommended that the CTSegment.AddSegment(CTIndex Index, int offset, int Length, SEG_MODE SegMode) implementation is not used, with considerable advantages for the use of the other implementations. The use of the extended segments (based on the segment offset), as needed in this implementation, may prevent the use of advanced c-tree Plus for .NET functions like CTTable.Alter(). If, for any reason, it is mandatory to use this implementation, try to adapt the example presented in the description of the ctdbAddSegmentEx() function in C API.

Return

AddSegment() returns a segment object.

See Also

DelSegment(), InsertSegment()

TOCIndex