Sort Orders

< BACK  NEXT >
[oR]

Property databases can have sort orders (which are really indexes) associated with up to CEDB_MAXSORTORDER properties to speed up retrieval this constant is currently defined as 4. Since the number of sort orders is limited, you need to choose carefully which properties to index properties that are used to filter or select records are the best candidates.

Sort orders are specified when the database is created using an array of SORTORDERSPEC structures:

 typedef struct _SORTORDERSPEC {   PEGPROPID propid;   DWORD dwFlags; } SORTORDERSPEC; 

The propid member specifies the property to be indexed, and dwFlags specify how to index. Four values can be used to specify sort orders (Table 4.6).

These flags can be combined, for example CEDB_SORT_DESCENDING | CEDB_SORT_CASEINSENSITIVE.

Table 4.6. Constants for index flags
Constant Purpose
CEDB_SORT_DESCENDING Sort order is descending. Default is ascending.
CEDB_SORT_CASEINSENSITIVE The sort order is case-insensitive. Only valid for strings.
CEDB_SORT_UNKNOWNFIRST Records that don't have the property value are ordered at the start of the record list.
CEDB_SORT_GENERICORDER Sort order is ascending, and case-sensitive, with records that don't contain the property value ordered at the end of the record list.
(Default sorting) Use the value 0 to specify default sorting.

For example, if you wanted to create two sort orders for a database on company name and company number, you would write:

 const CEPROPID propCompany = MAKELONG(CEVT_LPWSTR, 100); const CEPROPID propCompanyID = MAKELONG(CEVT_I4, 101); SORTORDERSPEC sorder[2]; sorder[0].propid = propCompany; sorder[0].dwFlags = 0;      // default sort order sorder[1].propid = propCompanyID; sorder[1].dwFlags = 0;  // default sort order 

< BACK  NEXT >


Windows CE 3. 0 Application Programming
Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)
ISBN: 0130255920
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net