4.3.4 ctdbAddIndex
Add a new index to a table.
Declaration
CTHANDLE ctdbAddIndex(CTHANDLE Handle, pTEXT name, CTDBKEY key_type,CTBOOL AllowDuplicates, CTBOOL NullFlag)Description
ctdbAddIndex adds a new index to a table. Use ctdbDelIndex to delete indices in a table. Use ctdbGetIndexKeyType to retrieve the key type of an index. ctdbAddIndex does the index allocation. After the segments, indices, and fields have been defined, the table can be created or altered.
- Handle [in] the table handle.
- name [in] the index name.
- key_type [in] the key type. Allowed key types are listed in Section 4.1 "c-treeDB definitions" on page 4-1,.
- AllowDuplicates [in] the indication if the index allow duplicate keys (YES or NO are the valid values).
- NullFlag [in] the indication if the index allow null keys (YES or NO are the valid values).
Returns
ctdbAddIndex returns the index handle on success, or NULL on failure.
Example
pMyField1 = ctdbAddField(pMyTable, "Name" , CT_FSTRING,32);pMyField2 = ctdbAddField(pMyTable, "Balance", CT_SFLOAT, 4);pMyIndex = ctdbAddIndex(pMyTable, "iName", CTINDEX_FIXED,NO,NO);pMyIseg = ctdbAddSegment(pMyIndex, pMyField1, 2);RetVal = ctdbCreateTable(pMyTable,"Table1",CTCREATE_NORMAL);See also
ctdbAllocTable, ctdbDelIndex, ctdbGetIndexKeyType, ctdbCreateTable, ctdbAlterTable, ctdbSetIndexName
|
FairCom Corporation www.faircom.com |