DropIndex
Permanent Incremental Index deletion.
Short Name
ctDROPIDX()
Type
ISAM Function
Declaration
COUNT DropIndex(FILNO keyno)
Description
In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering
DropIndex() permanently removes the index file referenced by keyno, which must be associated with a host index, not a member index. All the indexes contained in the index file are dropped and the IFIL resource in the data file is updated.
If the keyno index is transaction dependent, TRANDEP, DropIndex() must be performed under transaction control and can be undone by an abort or save point restore, but they are marked so that no ISAM update will touch these indexes.
Note: The key numbers associated with the data file may have a gap until the files are closed and reopened. For example, if a data file has key numbers 3, 4, 5, 6, 7, and 8 associated, and key 5 is its own file with one member, then after DropIndex(5) completes the key numbers associated with the data file will be: 3, 4, 7, and 8. After the data file is closed and reopened (at the ISAM level), the key numbers will be consecutive again: 3, 4, 5, and 6.
DropIndex() marks a transaction-controlled index for deletion by setting keylen to -keylen until the drop is committed. A GetIFile() call after the DropIndex() call, but before the Commit() or Abort() will return this interim setting.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful drop of index file. |
23 |
KMEM_ERR |
Attempt to drop a member index. |
48 |
FMOD_ERR |
keyno is not an index file. |
62 |
LERR_ERR |
File must be opened EXCLUSIVE. |
446 |
BMOD_ERR |
Attempt to drop a temporary index. |
Limitations
DropIndex() cannot be called for indexes created by TempIIndexXtd() or for member indexes. Specify a permanent host index to be dropped.
Both PermIIndex() and DropIndex() are only undoable if they are performed on TRANDEP files.
If there are pending DropIndex() calls, then no calls can be made to UpdateConditionalIndex() for any of the indexes associated with the underlying data file.
See also
PermIIndex, GetIFile, Commit, Abort, TempIIndexXtd, UpdateConditionalIndex