Previous Topic

Next Topic

ctdbAddTableXtd

Add an existing table to a database with additional physical file information.

Declaration

ctdbAddTableXtd( CTHANDLE Handle, pTEXT Name, pTEXT PhysicalName, pTEXT Path )

Description

ctdbAddTableXtd() adds an existing table to a database.

  • Handle [in] the database handle.
  • Name [in] the logical name of the table to be added as referenced in the c-treeDB database.
  • PhysicalName [in] the physical name of the file on disk, including the file extension, usually .dat
  • Path [in] the table path.

This extended function allows adding a table to a c-treeDB database specified with a logical and physical table name (the physical table name is the name on disk without extension and path), the logical table name is the one associated with file operations such as ctdbOpenTable().

Note: While multiple files with the same physical names can be added to a c-treeDB database dictionary, they logical names must still be unique.

A mirrored table can be added to a c-treeDB database dictionary by calling 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, "custmast1", "customer.dat" "c:\company1");
eRet = ctdbAddTable(hTable, "custmast2", "customer.dat" "c:\company2");

See also

ctdbAddTable(), ctdbCreateTable(), ctdbAllocTable(), ctdbDeleteTable(), ctdbDropTable()