FairCom Corporation


4.3.38 ctdbCreateTable


Create a new table.

Declaration

CTDBRET ctdbCreateTable(CTHANDLE Handle, pTEXT TableName,
CTCREATE_MODE CreateMode)

Description

ctdbCreateTable creates a new table. To create a session, use ctdbCreateSession. To create a database, use ctdbCreateDatabase. To retrieve the table create mode, use ctdbGetTableCreateMode. Use ctdbOpenTable to open an existing table.

The default directory for the table creation is the server (client/server) or application (stand alone) directory. To change the directory, call ctdbSetTablePath to set the new directory before creating the table. In order to create the table, its fields, indices and segments must be created first using, for instance, ctdbAddField, ctdbAddIndex, ctdbAddSegment.

Returns

ctdbCreateTable returns CTDBRET_OK on success or the c-treeDB C API error code on failure.

Example

pMyField = ctdbAddField(pMyTable, "Name", CT_FSTRING,32);
pMyIndex = ctdbAddIndex(pMyTable, "iName", CTINDEX_FIXED,NO,NO);
pMyIseg = ctdbAddSegment(pMyIndex, pMyField, 2);
RetVal = ctdbCreateTable(pMyTable,"Table1",CTCREATE_NORMAL);

See also

ctdbCreateSession, ctdbCreateSession, ctdbCreateDatabase, ctdbGetTableCreateMode, ctdbOpenTable, ctdbSetTablePath, ctdbAddField, ctdbAddIndex, ctdbAddSegment


FairCom Corporation
www.faircom.com