CTTable::Rebuild
Declaration
CTTable::Rebuild(CTREBUILD_MODE mode);
Description
CTREBUILD Mode |
Description |
CTREBUILD_NONE |
The normal rebuild mode. |
CTREBUILD_PURGEDUP |
Purge duplicate records during rebuild. |
CTREBUILD_UPDATEIFIL |
Update the IFIL structure in the table. |
CTREBUILD_DATAONLY |
Rebuild only the datafile. |
CTREBUILD_COMPACT |
Compact and rebuild. |
Note: Exercise care when using CTREBUILD_DATAONLY and CTCREBUILD_UPDATEIFIL modes together as the index files will be removed from the table IFIL definition even if the index files still exist in the file system. This can cause later problems if Alter() is called to recreate the removed indexes.
Rebuild() calls the FairCom DB CTRBLIFILX() function to rebuild a c-tree table. When used in conjunction with the open modes CTOPEN_CORRUPT and CTOPEN_DATAONLY, the Rebuild() function can be used as a direct replacement for the c-tree Plus ctrbldif rebuild utility.
The following steps are performed by c-treeDB during a table rebuild process:
You must open the table before Rebuild() is executed. It is recommended that the table be opened with CTOPEN_EXCLUSIVE mode. If the table is corrupt, you will need to open the table with the CTOPEN_CORRUPT mode and then call Rebuild() to rebuild the data and index files. If there are missing or corrupt index files, open the table with CTOPEN_DATAONLY mode and Rebuild() will reconstruct the missing index files.
There may be situations when you need to invoke this function to rebuild only the data file. After the data file rebuild is successful, you may need to call Rebuild() again to rebuild the index files.
Return Values
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
CTDBRET_OK |
Successful operation. |
650 |
DUPJ_ERR |
Duplicate keys purged and logged. |
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.
See Also
Alter()