Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Forcing a Table Rebuild

There may be situations where you 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.

CTTable ATable = new CTTable(ADatabase);


// open the table

ATable.Open("MyTable", OPEN_MODE.NORMAL_OPEN);


// rebuild all indexes

// alter the table to commit index changes to disk

try

{

ATable.Alter(ALTER_TABLE.FULL);

}

catch (CTException err)

{

Console.Write("Alter table failed with error {0}\n", err.GetErrorCode());

}

TOCIndex