Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTTable::AddSegment

Syntax

CTSegment AddSegment(const CTIndex& pIndex, const CTField& pField,

CTSEG_MODE SegMode)

CTSegment AddSegment(const CTIndex& pIndex, const CTString& FieldName,

CTSEG_MODE SegMode)

CTSegment AddSegment(const CTIndex& pIndex, NINT FieldNumber,

CTSEG_MODE SegMode)

CTSegment AddSegment(const CTIndex& pIndex, NINT offset, NINT Length,

CTSEG_MODE SegMode)

CTSegment AddSegment(NINT IndexNbr, NINT FieldNbr, CTSEG_MODE SegMode)

CTSegment AddSegment(NINT IndexNbr, const CTString& FieldName,

CTSEG_MODE SegMode)

CTSegment AddSegment(NINT IndexNbr, const CTField& pField, CTSEG_MODE SegMode)

CTSegment AddSegment(const CTString& IndexName, const CTString& FieldName,

CTSEG_MODE SegMode)

CTSegment AddSegment(const CTString& IndexName, NINT FieldNumber,

CTSEG_MODE SegMode)

CTSegment AddSegment(const CTString& IndexName, const CTField& pField,

CTSEG_MODE SegMode)

Parameters

  • pIndex [in] A pointer to the index object.
  • pField [in] A pointer to 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 (CTSEG_SCHSEG, CTSEG_USCHSEG, CTSEG_VSCHSEG, CTSEG_UVSCHSEG, CTSEG_SCHSRL).
  • 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-treeDB 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(const CTIndex& pIndex, NINT offset, NINT Length, CTSEG_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-treeDB 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.

Return

AddSegment() returns a segment object.

See also

InsertSegment(), DelSegment()

TOCIndex