Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbCreateMRTTable

ctdbCreateMRTTable() creates a new MRTTable based on a host table.

Declaration

CTDBRET ctdbCreateMRTTable (CTHANDLE Handle, pTEXT VTableName, pTEXT ParentName, CTCREATE_MODE CreateMode, pTEXT filter);

Description

  • Handle: MRTTable handle
  • VtableName: name of the MRTTable
  • ParentName: name of the host (or parent) table
  • CreateMode: virtual table create mode
  • filter: the filter to apply to the host table to identify the record belonging to this MRTTable

Once created, an MRTTable behaves as a regular c-treeDB API table.

Limitations: At this time it is not possible to use record filters and the ctdbAlterTable() function on a MRTTable Table.

Return Values

Value

Symbolic Constant

Description

4130

CTDBRET_NOMOREVTRES

No more RESOURCE for VTable available on parent table.

4131

CTDBRET_VTABLEEXIST

The table has VTable defined in the dictionary.

4132

CTDBRET_VTABLETYPE

VTable type mismatch between dictionary and resource.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

CTHANDLE pField0, pField1, pField2, pField3, pField4;

pField0 = ctdbAddField(hTableCustOrdr, "rectype", CT_FSTRING, 1);

pField1 = ctdbAddField(hTableCustOrdr, "co_ordrnumb", CT_FSTRING, 4);

pField2 = ctdbAddField(hTableCustOrdr, "co_ordrdate", CT_DATE, 4);

pField3 = ctdbAddField(hTableCustOrdr, "co_promdate", CT_DATE, 4);

pField4 = ctdbAddField(hTableCustOrdr, "co_custnumb", CT_FSTRING, 4);


if (!pField0 || !pField1 || !pField2 || !pField3 || !pField4)

Handle_Error("Define(): ctdbAddField()");

/* create table */

if (ctdbCreateMRTTable(hTableCustOrdr, "custordr","tutorial_host", CTCREATE_NORMAL|CTCREATE_NONULFLD,"rectype==\"O\""))

Handle_Error("ctdbCreateMRTTable()");

Note:

In V11.5, there has been a ctdbCreateMRTTable behavior change.

See Also

ctdbAddMRTTable(), ctdbAddVTableResource(), ctdbAllocVTableInfo(), ctdbFreeVTableInfo(), ctdbGetVTableInfoFromTable(), ctdbGetVTableNumber(), ctdbIsVTable(), ctdbRemoveVTableResource(), ctdbSetMRTTableFilter()

TOCIndex