INFO: CeWriteRecordProps May Modify Database Position (300163)
The information in this article applies to:
- Microsoft Windows CE Operating System, Versions 2.12
- Microsoft Windows CE Operating System, Versions 2.11
- Microsoft Windows CE Operating System, Versions 2.0
- Microsoft Windows CE Operating System, Versions 1.0
- Microsoft Windows CE Operating System, Versions 3.0
This article was previously published under Q300163 SUMMARY
The CeSeekDatabase or CeReadRecordProps API functions can be used to enumerate all records in a database. These functions maintain a pointer to the current record in the database. That pointer is preserved by calls to CeWriteRecordProps. However, calls to CeWriteRecordProps can modify the position of the current record. As a result, modification of records during performance of a database enumeration can cause an application to skip or reiterate records.
MORE INFORMATION
The CeSeekDatabase API function can be used to enumerate all records in a database through the use of the CEDB_SEEK_CURRENT flag with an increment of "1". Similarly, if you open a database and you use the CEDB_AUTOINCREMENT flag, CeReadRecordProps can be caused to enumerate records. Both functions depend on the current position pointer for the open database handle. While writes to the database do not move the current position pointer off the current record, they may cause the record to be reinserted into a different position in the sort order. The reinsertion may occur even if the sort property for that record was not modified. If the record is inserted earlier in the sort order, the enumeration process will return to records that had already been enumerated. If the record is inserted later in the sort order, the enumeration process will skip over records. Therefore, your code can throw off enumeration if it performs writes to records in the same database that it is enumerating. Instead, applications can restart enumeration after performing a write or can perform a full scan before making any changes, accumulating a list of records to modify.
Modification Type: | Minor | Last Reviewed: | 7/27/2004 |
---|
Keywords: | kbinfo KB300163 |
---|
|