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.
- pTable [in] the table handle.
- FieldName [in] the field name.
- FieldType [in] the field type. Available types are described in Section 4.1 "c-treeDB definitions" on page 4-1.
- FieldLength [in] the field length.
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 |