IDXDesc (index descriptor)

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

IDXDesc (index descriptor)

Return to chapter overview

The IDXDesc structure describes each index in a table. The same structure is used both in creating an index and inquiring about the index after a cursor is opened. The application does not specify the following fields in the index descriptor structure when creating an index: iRestrNum, bOutofDate, and iKeyLen.

The fields required in this structure vary by driver type and index type.

Note: The first three fields, szName, iIndexId, and szTagName are used to identify the index. A different combination of these three fields is used, depending on the driver type and on the specific index type. The rules are given below:

Driver Type

Index Type

Access

Either iIndexId or szName identifies the index.

dBASE

.NDX style: szName alone identifies the index.


.MDX style: szName and szTagName together identify the index.

FoxPro

.CDX style: szName and szTagName together identify the index.

Paradox

Either iIndexId or szName identifies the index.

Text driver

Indexing not supported.

All SQL drivers

szName alone identifies the index. pszIndexName may be used to identify a pseudo-index.

The fields in this structure include:

Field

Type

Description

szName

DBITBLNAME

Specifies the index name.

iIndexId

UINT16

Specifies the number identifying the index.

szTagName

DBINAME

Specifies the index tag name. Supported for dBASE and FoxPro only.

szFormat

DBINAME

Currently, for information only. Describes the physical index format type (for example, BTREE or HASH).

bPrimary

BOOL16

TRUE, if the key is primary.

bUnique

BOOL16

TRUE, if the key is unique.

abDescending

BOOL16

An array of booleans describing whether the corresponding field in aiKeyFld is descending. Used only when bDescending is set to TRUE.

bDescending

BOOL16

TRUE, if the key is descending.

bMaintained

BOOL16

TRUE, if the key is maintained.

bSubset

BOOL16

TRUE, if the index is a subset index. Supported for dBASE and FoxPro only.

bExpIdx

BOOL16

TRUE, if the index is an expression index. Supported for dBASE and FoxPro only.

iCost

UINT16

Reserved.

iFldsInKey

UINT16

Specifies the number of key fields in a composite index. If the index is an expression, set to 0.

iKeyLen

UINT16

Not specified while index is created. Specifies the physical length of the key in bytes. The application developer needs to allocate a buffer of iKeyLen bytes to use as a key buffer. A key buffer is used with functions such as DbiExtractKey and DbiSetToKey.

bOutofDate

BOOL16

Not specified while index is created; TRUE, if the index is out-of-date.

iKeyExpType

UINT16

Specifies the type of the key expression (dBASE and FoxPro only). This value can be one of the following: fldDBCHAR, fldDBKEYNUM, or fldDBKEYBCD.

aiKeyFld

DBIKEY

Specifies an array of field numbers in the key.

szKeyExp

DBIKEYEXP

Specifies the key expression for an expression index (dBASE and FoxPro only). This field is used only if bExpIdx = TRUE. The expression is stated as a dBASE expression.

szKeyCond

DBIKEYEXP

Specifies the expression that defines the subset condition (dBASE and FoxPro only). This field is used only if bSubset = TRUE. The expression is stated as a dBASE expression.

bCaseInsensitive

BOOL16

TRUE, if the index is case-insensitive.

iBlockSize

UINT16

Specifies the internal block size in bytes for this index.

iRestrNum

UINT16

Not specified while index is created. Specifies the internal restructure number for this index. This number is set when the index descriptor is retrieved and should not be changed when passing the descriptor back to DbiDoRestructure.

Note:        The following four fields, explained in detail above, are used to describe the key for an index: iFldsInKey, aiKeyFld, bExpIdx, szKeyExp. The key is described by specifying either one of the following combinations:

For traditional indexes

For expression indexes

iFldsInKey and aiKeyFld

bExpIdx and szKeyExp

See Also

IDXDesc characteristics by driver