WCEDBTST
The WCEDBTST sample demonstrates how to use the CCeDBDatabase, CCeDBRecord, CCeDBProp, and CCeDBEnum classes to create, destroy, sort, enumerate, access, and edit a Windows CE database in the object store.
To test the various operations you can perform on a Windows CE database, select any of the following commands from the File menu.
-
The Clear command clears the display.
-
The Basic Test command checks to see if a certain database exists in the object store. If the database exists, it opens it and then deletes it. Then it creates a new database, checks to verify that it was created, closes it, opens it again, and deletes it.
-
The Enumeration Test command creates three databases, and assigns the application-defined identifier '99' to each of them. It then creates two enumerators. The first enumerator enumerates all the databases in the object store; the second one enumerates only those databases that have the identifier '99.' The enumerators iterate through the specified databases, and the application retrieves the name and latest modification time of each one, and prints it to the display.
-
The Sort Test command creates a sample database and prints its contents to the display. Then it opens the database three times specifying a different sort property each time, and prints the results of each sort operation to the display. The first time, it specifies Age as the sort property. The second time it specifies Gender. Then it uses the sort property flags to reverse the sort order of the Last Names sort property, so the database is sorted alphabetically by last name, but in descending order, rather than ascending.
-
The Modify Test command creates a sample database and prints its contents to the display. Then it searches for a record that contains a specific value for a specific property (a person's last name), and changes the value of a different property in the retrieved record (the person's age). Then it prints the contents of the database to the display again.
-
The Seek Test command creates a sample database and prints its contents to the display. Then it performs several seek operations, printing the retrieved record to the display after each successful seek. It seeks the first record, the last record, and the second record, and saves a pointer to the second record so it can return to it later. Then it seeks the second from the last record, then the previous record, and then it returns to the record to which it previously saved a pointer. After that, it seeks the first record that has the value "Smith" for the Last Name property. Then it proceeds to seek the next two records in the database that also have the value "Smith" for their Last Name property. The last seek fails, because there are only two Smiths in the database.
-
The Deletion Test command creates a sample database and prints its contents to the display. Then it deletes a record and writes the contents of the database to the display again. Then it seeks a different record and deletes two properties from the record. After writing the contents of the database to the display again, it seeks another record, deletes a single property, and updates the display one more time.
These samples demonstrate the following keywords:
You can find the WCEDBTST project files in the Wce\Samples\Mfc\WCEDBTST directory.
To build the WCEDBTST sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.
-
WCE x86em (Desktop PC Windows CE emulation)
-
WCE x86
-
WCE PPC
-
WCE MIPS
-
WCE SH