FairCom Corporation


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.

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