Product Documentation

c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

New c-treeDB Ability to Clone a c-treeACE Table

A new function was added to c-treeDB to “clone” (duplicate) the structure of a table.


CTDBRET ctdbCloneTable( CTHANDLE tarTableHandle, pTEXT tarTableName, CTHANDLE srcTableHandle )

This function creates a new table with the attributes from an existing source table. This does NOT create a duplicate table -- records are not copied.

Notes:
1. This function is only for a CTSESSION_CTREE session or for cloning tables from/into different databases.
2. The table to be cloned must be closed as ctdbCloneTable() requires an exclusive open on the file.
3. Only the table name is required, not the physical file name.

Example

CTHANDLE hTable1;

CTHANDLE hTable2;


ctdbLogon(hSession, "FAIRCOMS", "ADMIN", "ADMIN");


hSession = ctdbAllocSession(CTSESSION_CTREE);

hDatabase = hSession;


hTable1 = ctdbAllocTable(hDatabase);

hTable2 = ctdbAllocTable(hDatabase);


ctdbSetTablePath(hTable1, ".\\data1");

ctdbSetTablePath(hTable2, ".\\data2");


ctdbCloneTable(hTable1, "custmast", hTable2);

TOCIndex