Microsoft Windows CE 3.0  

Using a Windows CE Database

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Databases provides storage, access, and sorting of property-set records. The Windows CE database model is that of a small, flat structure, optimized for small, efficient storage. As such, the Windows CE database APIs do not correspond to the Win32 database APIs. Data operations are transactioned, which protects against data loss. If a Windows CE–based device loses power (reset or suspend/resume, where the RAM is refreshed) during a data transaction, Windows CE reverts all partial database operations to the last known good state.

Prior to Windows CE 2.10, a Windows CE database could exist only in the object store. Effective with version 2.10 Windows CE supports databases anywhere on the device, including PC Cards and other installed file systems. Conceptually, the object store is a single, special database volume that is always mounted.

The database model . Each Windows CE database contains a maximum of CEDB_MAXSORTORDER sort indices, and one or more records. The maximum size of a record is defined in the CEDB_MAXRECORDSIZE constant in Windbase.h, and in Rapi.h for remote API (RAPI) calls.

A record can have a variable number of properties, but it cannot contain another record. The maximum size of a property is defined in the CEDB_MAXPROPDATASIZE constant, Windows CE allocates space for a record or property only when necessary. Effective in version 3.0, a new constant CEDB_MAXNUMRECORDS of 65,535 has been added to indicate the maximum number of records that can be added to a database. Before version 3.0, the maximum the record limit was implicitly imposed by the maximum number of objects that could be placed in the object store. The following table shows the different types of available record properties.

Note   The BOOL and floating-point properties are available only on Windows CE 2.10 and later.

The overhead associated with creating a record is 20 bytes per record; the overhead for a property is 4 bytes per property.

In addition to records, a database contains a name and type identifier. The database name is a null-terminated string of up to 32 characters. The type identifier is application-specific and commonly used to identify similar databases. For example, the Microsoft Pocket suite uses the number 24 as a type identifier for every Contacts database.

Because Windows CE is designed to operate in a relatively volatile environment, the Windows CE database does not update automatically only when the database opens or closes. Instead, the database updates after each individual transaction, such as a call to the CeWriteRecordPropsfunction. A database volume is a file that contains all of the data that is necessary for the databases inside it. Individual database volumes can be up to 256 MB in Windows CE 3.0, or up to 16 MB prior to 3.0.




Record property type
Contains
CEVT_BOOL Boolean value
CEVT_CEBLOB Binary object
CEVT_R8 8-byte floating-point value
CEVT_FILETIME Time and date data
CEVT_I2 2-byte signed integer
CEVT_I4 4-byte signed integer
CEVT_LPWSTR Long pointer to a Unicode string
CEVT_UI2 2-byte unsigned integer
CEVT_UI4 4-byte unsigned integer