DbiGetIndexForField

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiGetIndexForField

Return to chapter overview

C syntax

DBIResult DBIFN DbiGetIndexForField (hCursor, iFld, bProdTagOnly, [pidxDesc]);

Delphi syntax

function DbiGetIndexForField (hCursor: hDBICur; iFld: Word; bProdTagOnly: Bool; var idxDesc: IDXDesc): DBIResult stdcall;

Description

DbiGetIndexForField returns the description of any useful index on the specified field. You can also use it just to check if an index exists for the given field.

Parameters

hCursor                Type: hDBICur                (Input)
Specifies the cursor handle.

iFld                Type: UINT16                (Input)
Specifies the field number.

bProdTagOnly                Type: BOOL                (Input)
For dBASE only. If set to TRUE, only dBASE production tags are searched.

pidxDesc                Type: pIDXDesc                (Output)
Pointer to the client-allocated IDXDesc structure.

Usage

Paradox: If multiple indexes exist on the field, the following order of precedence is followed: primary index, secondary index on the specified field only, and secondary composite index with the specified field as the first component.

dBASE or FoxPro: For dBASE or FoxPro tables, only simple indexes are considered because there are no composite indexes. Expression indexes are not considered.

Access: The first index found is used.

SQL: For SQL tables, if multiple indexes are created for the field, the first useful index is returned. (An attempt is made to return the unique index with the least number of fields in the key. If there is no unique index, an index with the least number of fields in the key is returned.)

Prerequisites

A valid cursor handle must be obtained on a base table, not on a query or in-memory or temporary table.

Completion state

The index Description is returned in the specified IDXDesc structure.

DbiResult

Meaning

DBIERR_NONE

The index descriptors were returned successfully.

DBIERR_INVALIDHNDL

The specified handle is invalid or NULL.

DBIERR_NOSUCHINDEX

No index on this field.

See also

DbiOpenIndex, DbiCloseIndex, DbiDeleteIndex, DbiAddIndex