Share via


CeSeekDatabase

This function seeks the specified record in an open database. A remote application interface (RAPI) version of this function exists, and it is also called CeSeekDatabase.

CEOID CeSeekDatabase(
HANDLE hDatabase, 
DWORD dwSeekType, 
DWORD dwValue, 
LPDWORD lpdwIndex); 

Parameters

  • hDatabase
    [in] Handle to the open database in which to seek.

  • dwSeekType
    [in] Specifies the type of seek operation to perform. It is one of the following values:

    Value Description
    CEDB_SEEK_CEOID Seek until finding an object that has the specified object identifier. The dwValue parameter specifies the object identifier. This type of seek operation is very efficient.
    CEDB_SEEK_VALUESMALLER Seek until finding the largest value that is smaller than the specified value. If none of the records has a smaller value, the seek pointer is left at the end of the database and the function returns zero. The dwValue parameter is a property value identifier. For more information about this value, see the propid member of the CEPROPVAL structure.
    CEDB_SEEK_VALUEFIRSTEQUAL Seek until finding the first value that is equal to the specified value. If the seek operation fails, the seek pointer is left pointing at the end of the database, and the function returns zero. The dwValue parameter is a property value identifier. For more information about this value, see the propid member of the CEPROPVAL structure.
    CEDB_SEEK_VALUENEXTEQUAL Starting from the current seek position, seek exactly one position forward in the sorted order and check if the next record is equal in value to the specified value. If so, return the object identifier of this next record; otherwise, return zero and leave the seek pointer at the end of the database. This operation can be used in conjunction with the CEDB_SEEK_VALUEFIRSTEQUAL operation to enumerate all records with an equal value. The dwValue parameter specifies the value for which to seek.
    CEDB_SEEK_VALUEGREATER Seek until finding a value greater than or equal to the specified value. If all records are smaller, the seek pointer is left at the end of the database and the function returns zero. The dwValue parameter is a property value identifier. For more information about this value, see the propid member of the CEPROPVAL structure.
    CEDB_SEEK_BEGINNING Seek until finding the record at the specified position from the beginning of the database. The dwValue parameter specifies the number of records to seek.
    CEDB_SEEK_CURRENT Seek backward or forward from the current position of the seek pointer for the specified number of records. The dwValue parameter specifies the number of records from the current position. The function seeks forward if dwValue is a positive value, or backward if it is negative. A forward seek operation is efficient.
    CEDB_SEEK_END Seek backward for the specified number of records from the end of the database. The dwValue parameter specifies the number of records.
  • dwValue
    [in] Specifies the value to use for the seek operation. The meaning of this parameter depends on the value of dwSeekType.

  • lpdwIndex
    [out] Pointer to a variable that receives the index from the start of the database to the beginning of the record that was found. This parameter cannot be NULL.

Return Values

The object identifier of the record on which the seek ends indicates success. Zero indicates failure. To get extended error information within a CE program, call GetLastError. GetLastError may return ERROR_INVALID_PARAMETER if a parameter is invalid.

Remarks

Note Earlier versions (2.12 and prior) of Windows CE assigned OIDs to objects in other file systems, such as the FAT file system. These OIDs were guaranteed to be unique within a volume, but not across multiple volumes. Effective with version 3.0, only objects in the object store have valid, unique OIDs and the object store is the only volume that can return an object identifier.

The CeSeekDatabase function always uses the current sort order as specified in the call to the CeOpenDatabaseEx function. If the CEDB_AUTOINCREMENT flag was specified, an automatic seek of one from the current position is done with each read operation that occurs on the database. If a seeks fails then the record pointer points to the same record as before the seek operation.

Note that a seek can only be performed on a sorted property value. After creating a database (using CeCreateDatabaseEx) and opening the database (using CeOpenDatabaseEx), subsequent calls to CeSeekDatabase assume the sort order that was specified in the propid parameter of the call to CeOpenDatabaseEx.

To enter negative values for the CEDB_SEEK_CURRENT case, cast a signed long. This changes the effective range on the record indexes to 31 bits from 32.

Multiple sort orders cannot be specified for a single property.

When a CEPROPVAL structure is required to seek operation, the propid parameter must be set to the PROPID of the sort order specified in the CeOpenDatabaseEx call.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.01 and later Windbase.h Winbase.h Fsdbase.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CeCreateDatabaseEx, CeOpenDatabaseEx, CeSeekDatabase, GetLastError, CEPROPVAL

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.