AdsBuildRawKey

Advantage Client Engine

Creates a raw key that can be used with the ADS_RAWKEY data type in calls to AdsSeek, AdsSeekLast, AdsLookupKey, and AdsSetScope.

Syntax

UNSIGNED32

AdsBuildRawKey (ADSHANDLE hIndex,

UNSIGNED8 *pucKey,

UNSIGNED16 *pusKeyLen);

Parameters

hIndex (I)

Handle of index order.

pucKey (O)

Return key in this buffer.

pusLen (I/O)

Length of given buffer on input, length of returned data on output.

Remarks

AdsBuildRawKey will build the raw seek key based on the "AdsSet" calls that have been made since the call to AdsInitRawKey for this index handle.

The key length passed in to AdsBuildRawKey should be the maximum length for the key possible. This can be obtained through a call to AdsGetKeyLength.

The following sequence of calls might be used to build a raw seek key for an index built on "lastname+firstname":

ulRet = AdsInitRawKey( hIndex );

ulRet = AdsSetString( hIndex, "lastname", "Adams", 5 );

ulRet = AdsSetString( hIndex, "firstname", "John", 4 );

usKeyLen = sizeof( aucKey );

ulRet = AdsBuildRawKey( hIndex, aucKey, &usKeyLen );

ulRet = AdsSeek( hIndex, aucKey, usKeyLen, ADS_RAWKEY, ADS_HARDSEEK, &pbFound);

Note that any fields that are not set, will be "empty". The right-most field that is set determines the actual key length. If in the above example both lastname and firstname fields are 20 characters long, then the key created above would be 24 characters long. If an index is "f1;f2;f3" and only fields f1 and f3 were set, then the final key will include "blanks" for f2.

Example

Click Here

See Also

AdsInitRawKey

AdsSeek

AdsSeekLast

AdsSetScope

AdsLookupKey

AdsSetDate

AdsSetDouble

AdsSetEmpty

AdsSetField

AdsSetJulian

AdsSetLogical

AdsSetLong

AdsSetMilliseconds

AdsSetRecord

AdsSetShort

AdsSetString

AdsSetTime