Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbAddTable

Add an existing table to a database.

Declaration

CTDBRET ctdbAddTable(CTHANDLE Handle, pTEXT Name, pTEXT Path)

Description

ctdbAddTable() adds an existing table to a database. Use the Path parameter to specify where the table files are on disk. If Path is left empty, FairCom DB API will attempt to locate the files in the Server directory (client/server) or in the execution directory (standalone).

  • Handle [in] - the database handle.
  • Name [in] - the name of the table be added, including the file extension, usually .dat.
  • Path [in] - the table path.

A mirrored table can be added to a FairCom DB API database dictionary by calling the ctdbAddTable() function and specifying the table name and path using the appropriate mirror naming convention:

if (ctdbAddTable(hDatabase, "customer|mirror", "primary_path|mirror_path"))

printf("ctdbAddTable failed\n");

If a table is created originally without mirroring, it can subsequently be mirrored as follows:

  1. Copy the original table to the mirror location.
  2. Change the ctdbOpenTable() function to use the mirror naming convention.

Returns

ctdbAddTable() returns CTDBRET_OK on success, or the c-tree error code on failure.

Example


CTHANDLE hTable;


eRet = ctdbAddTable(hTable, "custmast", "");

See also

ctdbAddTableXtd (ctdbAddTableXtd, ctdbAddTableXtd), ctdbCreateTable, ctdbAllocTable, ctdbDeleteTable, ctdbDropTable, ctdbSetDefaultSqlTableOwner

TOCIndex