FairCom Corporation


4.3.3 ctdbAddField


Add a new field to table

Declaration

CTHANDLE ctdbAddField(CTHANDLE Handle, pTEXT FieldName,
CTDBTYPE FieldType, VRLEN FieldLength)

Description

ctdbAddField adds a new field to a table. Use ctdbInsField and ctdbInsFieldByName to insert a field in a table in a specified position. Use ctdbDelField and ctdbDelFieldByName to delete fields from the table. ctdbAddField does the field handle allocation. After the segments, indices, and fields have been defined, the table can be created or altered with ctdbCreateTable or ctdbAlterTable.

Returns

ctdbAddField returns a field 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, ctdbInsField, ctdbInsFieldByName, ctdbDelField, ctdbDelFieldByName, ctdbMoveField, ctdbCreateTable, ctdbAlterTable


FairCom Corporation
www.faircom.com