次の方法で共有


Modifying the Sort Order (Windows Embedded CE 6.0)

1/6/2010

When you create a database, you can define up to four different sort orders. Typically, each record in a database contains a similar set of properties, and each type of property shares the same property identifier. For example, each record in a Contacts database might contain a name, street address, city, state or province, postal code, and telephone number. All name properties would have the same property identifier, all street addresses would have the same property identifier, and so on. You can select one of these properties and sort the records, based on that property. However, you cannot perform a sort on a binary property. The order in which the records are sorted affects the order in which the CeSeekDatabaseEx (CEDB) database-seeking function finds records in the database.

You specify the four sort orders that you want to use on a database when you call the CeOpenDatabaseEx2 (CEDB) function by using the SORTORDERSPEC (CEDB) structure. SORTORDERSPEC contains the identifier of a single property on which the database properties are to be sorted. SORTORDERSPEC also includes a combination of flags that indicate whether to sort the records in ascending or descending order, whether the sort is case-sensitive, and whether to place records that do not contain the specified property before or after all of the other records. By default, sorting is done in ascending order and is case-sensitive. Windows Embedded CE places all of the records that do not contain the specified property at the end of all of the other records. Although you can have only one sort order active for each handle, you can open multiple handles to a database. By using multiple handles, you can use more than one sort order.

You can change these four sort orders or other database properties by calling the CeSetDatabaseInfoEx2 (CEDB) function. CeSetDatabaseInfoEx2 enables you to change the database name, type, or any of the four sort orders. However, it is more efficient to include any necessary sort orders when you create the database. When you change a sort order, Windows Embedded CE parses the database and changes each record. This process might take several minutes on a large database. If you must change the sort order, inform the user of the projected time delay.

A sort order can contain up to CEDB_MAXSORTPROP properties. A new structure exists to describe the new sort index SORTORDERSPECEX (CEDB), as well as new functionality in CeOpenDatabaseEx2 and CEDBASEINFOEX (CEDB).

See Also

Concepts

CEDB Database Support