4.3.6 ctdbAddSegmentByName
Add a new index segment, given the field name.
Declaration
CTHANDLE ctdbAddSegmentByName(CTHANDLE Handle, NINT IndexNbr,pTEXT FieldName, CTSEG_MODE SegMode)Description
ctdbAddSegmentByName adds a new index segment, given the field name and the index number. The operation of adding a segment links the index with the field in the table. In order to add 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.
Use ctdbAddSegmentByNbr to add a new index segment given the field and index number. Use ctdbAddSegment to add a new index segment given the index handle. Use ctdbAddSegmentEx to add a new extended index segment.
ctdbAddSegmentByName does the segment allocation. After the segments, indices, 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. The first index is number 0.
- 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 Section 4.1 "c-treeDB definitions" on page 4-1. If used with a different segment mode, this call will return error 4047, meaning invalid segment mode. ctdbAddSegmentEx accepts any segment mode.
Returns
ctdbAddSegmentByName returns the segment handle on success, or NULL on failure
Example
ctdbAddField(pMyTable, "Name", CT_FSTRING, 32);ctdbAddField(pMyTable, "Balance", CT_SFLOAT, 4);ctdbAddIndex(pMyTable, "iName", CTINDEX_FIXED, NO, NO);ctdbAddSegmentByName(pMyTable, 0, "Name", CTSEG_USCHSEG);RetVal = ctdbCreateTable(pMyTable, "Table1", CTCREATE_NORMAL);See also
ctdbAddSegmentEx, ctdbAddSegmentByNbr, ctdbAddSegment
|
FairCom Corporation www.faircom.com |