Specifies a filter condition for a view.
HRESULT SetFilter (
HACCESSOR hAccessor,
ULONG cRows,
DBCOMPAREOP CompareOps[],
void * pCriteriaData);
Parameters
hAccessor
[in]
The handle of the accessor which describes the data in pCriteriaData. The same column may appear more than once in the criteria.
cRows
[in]
The number of rows in the criteria table, where the criteria described by each row is joined in a logical OR with the other rows. Some providers may have limits on the number of rows (OR conditions) that can be expressed in the criteria.
CompareOps
[in]
A two-dimensional array containing cRows by cBindings comparison operators in cRows-major format, where cBindings is the number of columns represented in hAccessor. Each comparison operator in the cBindings dimension refers to a column in pCriteriaData, and each set of columns in the pcRows dimension refers to a row in pCriteriaData. Columns within a row are joined together in a logical AND, and each row is joined in a logical OR with another row. The consumer should check DBPROP_FINDCOMPAREOPS to determine which comparison operators the provider supports. For information about the DBCOMPAREOP enumerated type, see IRowsetFind::FindNextRow.
pCriteriaData
[in]
A pointer to memory containing the data values, at offsets that correspond to the bindings in the accessor which, in conjunction with the array of comparison operators, define the criteria.
Return Code
S_OK
The method succeeded.
E_FAIL
A provider-specific error occurred.
DB_E_BADCOMPAREOP
In an element of CompareOps, both DBCOMPAREOPS_CASESENSITIVE and DBCOMPAREOPS_CASEINSENSITIVE were specified.
The provider was asked for an option that it does not support.
DB_E_CANTFILTER
The described filter could not be applied. The provider may have limitations on the columns used in a filter or a limitation on the complexity of the filter.
Comments
A provider may restrict filter columns to use only existing indexes, or may restrict a filter to work only with an order chapter as a source.
If there is already a filter condition applied to a view, SetFilter overrides that previous filter condition.
Changing the filter condition of a view does not change the filtering of any rowsets or chapters opened using that view.