Windows CE provides a simple database API containing a single level and a maximum of four sort indices. Prior to Windows CE 2.10, a Windows CE database could exist only in the object store. Windows CE 2.10 and later enables you to store and access a database in a database volume, anywhere on the device. This includes PC Cards or other installed file systems. The file is called a volume because it can contain more than one database. Use the database API to create and store a simple database, such as a phone number listing or an e-mail repository.
A Windows CE database consists of one or more records. The maximum size of a record is defined in the CEDB_MAXRECORDSIZE constant in Windbase.h; for Windows CE 2.10, CEDB_MAXRECORDSIZE is 131,072 bytes. 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, which is 65,471 bytes. Windows CE allocates space for a record or property only when necessary. These same constants are defined in Rapi.h for remote API (RAPI) calls. The following table shows the different types of available record properties.
Record property type |
Contains |
CEVT_BOOL | Boolean value |
CEVT_CEBLOB | Binary object |
CEVT_R8 | 8-byte signed 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 |
Note The BOOL and Double properties are available only on Windows CE version 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 is commonly used to identify similar databases. For example, the Microsoft Pocket suite uses the number 24 as a type identifier for all Contacts databases.
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 CeWriteRecordProps call.