Advantage Client Engine
Retrieves a bookmark for use in a later call to AdsGotoBookmark60 or AdsCompareBookmarks.
Syntax
UNSIGNED32 |
AdsGetBookmark60 (ADSHANDLE hObj, UNSIGNED8 *pucBookmark); |
hObj (I) |
Handle of a table, cursor, or index. |
pucBookmark (O) |
Pointer to pre-allocated memory to place the bookmark in. |
AdsGetBookmark60 returns a bookmark into user-allocated space. Allocate pucBookmark using the bookmark length retrieved from a call to the AdsGetBookmarkLength API. Bookmark length is dependent on the key size of the index in question (if the hObj parameter is an index handle, or a cursor handle based on an SQL statement that utilizes an ORDER BY).
UNSIGNED32 ulRetVal;
UNSIGNED32 ulBookmarkLength;
UNSIGNED8 *pucBookmark1, *pucBookmark2;
SIGNED32 lResult;
/* Get the bookmark size for this index. */
ulRetVal = AdsGetBookmarkLength( hIndex, &ulBookmarkLength );
if ( ulRetVal != AE_SUCCESS )
return ulRetVal;
/* Allocate two bookmarks. */
pucBookmark1 = (UNSIGNED8*)malloc( ulBookmarkLength );
pucBookmark2 = (UNSIGNED8*)malloc( ulBookmarkLength );
/* Gotop and get a bookmark. */
AdsGotoTop( hIndex );
ulRetVal = AdsGetBookmark60( hIndex, pucBookmark1 );
if ( ulRetVal != AE_SUCCESS )
return ulRetVal;
/* Skip 3 records and get a bookmark. */
AdsSkip( hIndex, 3 );
ulRetVal = AdsGetBookmark60( hIndex, pucBookmark2 );
if ( ulRetVal != AE_SUCCESS )
return ulRetVal;
/* Compare the bookmarks. */
ulRetVal = AdsCompareBookmarks( pucBookmark1, pucBookmark2, &lResult );
if ( ulRetVal != AE_SUCCESS )
return ulRetVal;