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.
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
|