Advantage Client Engine
Initializes the creation of a raw key that can be used with the ADS_RAWKEY data type in calls to AdsSeek, AdsSeekLast, AdsLookupKey, and AdsSetScope.
UNSIGNED32 |
AdsInitRawKey(ADSHANDLE hIndex); |
hIndex (I) |
Handle of index order. |
After calling AdsInitRawKey, make calls to the "AdsSet" APIs to set field values for the key with an hIndex handle instead of the usual hTable handle. After the desired fields have been set, call AdsBuildRawKey. For example, 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.