Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Forcing a table rebuild

There may be situations where you may need to force a full table rebuild. Please remember that in a full table rebuild, a temporary table is created based on the properties of the original table, then all records are read from the original table and written into the temporary table. All indexes are also rebuilt. Once all data records have been moved, the original table is deleted and the temporary table is renamed with the name of the original table.

// rebuild a table

CTTable ATable(ADatabase);


// open the table

ATable.Open("MyTable", CTOPEN_NORMAL);


// rebuild the table

try

{

ATable.Alter(CTDB_ALTER_FULL);

}

catch (CTExplorer &err)

{

printf("Alter table failed with error %d\n", err.GetErrorCode());

}

TOCIndex