DbiExtractKey

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiExtractKey

Return to chapter overview

C syntax

DBIResult DBIFN DbiExtractKey (hCursor, [pRecBuf], pKeyBuf);

Delphi syntax

function DbiExtractKey (hCursor: hDBICur; pRecBuf: Pointer; pKeyBuf: Pointer): DBIResult stdcall;

Description

DbiExtractKey retrieves the key value for the current record of the given cursor or from the supplied record buffer.

Parameters

hCursor                Type: hDBICur                (Input)
Specifies the cursor handle. The cursor must be opened with an active index.

pRecBuf                Type: pBYTE                (Input)
Pointer to the record buffer from which to extract the key. Optional; if NULL, DbiExtractKey extracts the key from the current record.

pKeyBuf                Type: pBYTE                (Output)
Pointer to the client buffer receiving the key value. The length of the key value can be determined by retrieving the Index Descriptor (IDXDesc) and using iKeyLen or iKeySize in the CURProps structure.

Prerequisites

An index must be active. To retrieve the key from the current record, the cursor must be on a valid record.

Completion state

The extracted key value is returned in pKeyBuf. The returned key can be used as input to functions such as DbiSetToKey, DbiSetRange, and DbiCompareKey.

Note:        In case a field map is active on the cursor, and does not include one or more of the index fields, those index fields become blanks in the extracted key if a record buffer was supplied.
Note:        The key length is not affected by a field map.

DbiResult

Meaning

DBIERR_NONE

The key value was retrieved successfully.

DBIERR_INVALIDHNDL

The specified cursor handle is invalid or NULL.

DBIERR_NOASSOCINDEX

The cursor does not have an index active.

DBIERR_NOCURRREC

The cursor is not positioned on a record.

See also

DbiGetCursorProps, DbiSetToKey, DbiSetRange, DbiCompareKeys, DbiGetRecordForKey