xHarbour Reference Documentation > Command Reference |
Rebuilds all open indexes in the current work area.
REINDEX [EVAL <bBlock>] ; [EVERY <nInterval>]
The code block is evaluated for each record unless the EVERY option is specified. It is recommened to use EVERY in conjunction with EVAL.
The REINDEX command rebuilds all open indexes in the current work area. During the operation the FOR condition, UNIQUE flag and ASCENDING/DESCENDING status defined with the INDEX command are maintained.
REINDEX requires a database be opened in EXCLUSIVE mode, otherwise a runtime error is generated. When the operation is complete, the first index becomes the controlling index and the record pointer is positioned on the first logical record.
Important: REINDEX does not repair an index file header. If an index file gets corrupted, use the INDEX command to re-create index files from scratch.
See also: | INDEX, OrdCondSet(), OrdCreate(), OrdListRebuild(), PACK, SET INDEX, USE |
Category: | Database commands , Index commands |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// This example reindexes the indexes open in the current work area: PROCEDURE Main USE Customer INDEX Cust01, Cust02, Cust03 EXCLUSIVE REINDEX CLOSE Customer RETURN
http://www.xHarbour.com