|
<< Click to Display Table of Contents >> DbiDeleteIndex |
![]() ![]()
|
C syntax
DBIResult DBIFN DbiDeleteIndex (hDb, hCursor, pszTableName, [pszDriverType], pszIndexName, pszIndexTagName, iIndexId);
Delphi syntax
function DbiDeleteIndex (hDb: hDBIDb; hCursor: hDBICur; pszTableName: PChar; pszDriverType: PChar; pszIndexName: PChar; pszIndexTagName: PChar; iIndexId: Word): DBIResult stdcall;
Description
DbiDeleteIndex drops an index on a table.
Parameters
hDb Type: hDBIDb (Input)
Specifies the database handle.
hCursor Type: hDBICur (Input)
Specifies the cursor handle. If hCursor is specified, the operation is performed on the table associated with that cursor. If hCursor is NULL, pszTableName and pszDriverType determine the table to be used. This option is not supported with Access tables.
pszTableName Type: pCHAR (Input)
Pointer to the table name. If hCursor is NULL, pszTableName and pszDriverType determine the table to be used. (If both pszTableName and hCursor are specified, pszTableName is ignored.)
For Paradox, FoxPro, and dBASE, if pszTableName is a fully qualified name of a table, the pszDriverType parameter need not be specified. If the path is not included, the path name is taken from the current directory of the database associated with hDb.
For SQL databases, this parameter can be a fully qualified name that includes the owner name.
pszDriverType Type: pCHAR (Input)
Pointer to the driver type. Optional. For Paradox, FoxPro, and dBASE tables, this parameter is required if pszTableName has no extension. This parameter is ignored if the database associated with hDb is a SQL database. pszDriverType can be one of the following values: szDBASE, szMSACCESS, or szPARADOX.
pszIndexName Type: pCHAR (Input)
Pointer to the name of the index to be dropped. See IDXDesc for index naming rules.
pszIndexTagName Type: pCHAR (Input)
Pointer to the index tag name. Used only to identify dBASE .MDX or FoxPro .CDX indexes. (See the pszIndexName parameter description above.) This parameter is ignored for Paradox and SQL tables.
iIndexId Type: UINT16 (Input)
Specifies the index identifier, which is the number of the index to be used. The range for the index identifier is 1 to 511. Used for Paradox tables only and is ignored if pszIndexName is specified.
Usage
Used to drop an index. The client application can either specify the table by name or by opening a cursor on the table. If a cursor is specified, it must not be opened with the index to be deleted.
Prerequisites
If hCursor is specified, an exclusive cursor handle must be supplied. The index must exist. See the following driver-specific information for locking requirements. A currently active index cannot be dropped. If the table name is specified, the table must be able to be opened exclusively.
dBASE and FoxPro: The table must be opened exclusively on behalf of the client application.
Paradox: The table must be opened exclusively on behalf of the client application. (The client application must have permission to lock the table exclusively.)
SQL: The table must be open exclusively where table locking is supported by the driver.
Access: The table must be closed to to drop an index.
Oracle8: Not supported for object types (ADT, REF, nested table, and VARARRAY).
Completion state
If a cursor is specified, DbiDeleteIndex does not affect the order or the position of the cursor.
DbiResult |
Meaning |
DBIERR_NONE |
The index was successfully deleted. |
DBIERR_INDEXNAMERQUIRED |
An index name is required. |
DBIERR_INDEXREADONLY |
An illegal attempt was made to delete a read-only index. |
DBIERR_ACTIVEINDEX |
An illegal attempt was made to delete an active, primary index. |
DBIERR_MUSTUSEBASEORDER |
An illegal attempt was made to delete an active, secondary index. |
DBIERR_INVALIDHNDL |
Handle was invalid or NULL. |
DBIERR_NEEDEXCLACCESS |
Exclusive access is required to delete the index. |
DBIERR_NOSUCHINDEX |
The specified index does not exist. |
See also
DbiAddIndex, DbiCloseIndex, DbiOpenIndexi, DbiSwitchToIndex, DbiDoRestructure