The Table_RebuildIndexes() function rebuilds the indexes for a table that stores data using the c-tree Plus database manager. The Table_GetAutoShrinkMode() function must be used prior to this function to ascertain whether the database manager used to create the table supports this capability.
• table table_name – The table for which indexes are being rebuilt.
An integer indicating the error code returned by the database manager. If the return value is 0, no error occurred. Consult your c-tree Plus reference manual for a list of error codes.
Like Table_AutoShrink(), this function removes and then rebuilds the indexes for an existing c-tree Plus data table. These indexes are stored in the .IDX file with the same name to the left of the extension as the data table. For example, the indexes for the INVENT.DAT data table are stored in the INVENT.IDX index file.
However, unlike Table_AutoShrink(), which also shrinks the data table by removing the unused portions of that table before rebuilding the indexes, this function doesn’t change the data table in any way. It simply reads from the data table, gathering the information it needs to successfully rebuild the indexes.
The Table_RebuildIndexes() function is useful if you want to rebuild the indexes for a large data table that isn’t deleted from very often, and therefore rarely has any unused space in it. Also, this function is useful if you have a large data table and don’t have the amount of free hard disk space needed to perform a shrink, which copies the data table to a new table, eliminating unused space in the process.
Since the functionality of this function is accomplished by Table_AutoShrink(), and Table_AutoShrink() also removes unused portions of the data table, under normal circumstances, we recommend that you use Table_AutoShrink() instead.