OLE DB Programmer's Reference |
The MEMBERS rowset can have up to 12 restrictions. The first 11 are the columns in the MEMBERS rowset:
The 12th restriction, called the tree operation, is not on any particular column of the MEMBERS rowset; rather, it specifies a tree operator. This allows the consumer to specify a MEMBER_UNIQUE_NAME restriction and the tree operator (ANCESTORS, CHILDREN, SIBLINGS, PARENT, DESCENDANTS, SELF) to obtain the desired set of members. The constants for tree operations, described in the following table, comprise a bitmask and can be combined. They are defined in the header file.
Constant | Description |
---|---|
MDTREEOP_ANCESTORS | Returns all of the ancestors. |
MDTREEOP_CHILDREN | Returns only the immediate children. |
MDTREEOP_SIBLINGS | Returns members on the same level. |
MDTREEOP_PARENT | Returns only the immediate parent. |
MDTREEOP_SELF | Returns itself in the list of returned rows. |
MDTREEOP_DESCENDANTS | Returns all of the descendants. |
With one exception, specifying more than one restriction results in each of the restrictions being joined by an AND operation. For example, if the consumer specifies a level name restriction of "General Managers" and the member name restriction of "Bill", the effect is to find "Bill" among "General Managers".
Tree operator restrictions are an exception to this rule. Tree operators operate on a particular member. This member is specified by using the other restrictions, such as member name, level name, level number, and so forth.
The tree operator interacts with other restrictions as follows:
The consumer can combine more than one tree operator by using the bitwise-OR operator of C and Microsoft Visual C++ . MDTREEOP_CHILDREN | MDTREEOP_SELF returns a rowset containing the list of children of the specified member and the member itself.
The data type for the tree operator restriction that the provider expects in the rgRestrictionsArray parameter of IDBSchemaRowset::GetRowset is DBTYPE_I4.
Note PARENT_UNIQUE_NAME is not a restriction because specifying the tree operator MEMBER_PARENT can do the same thing.
When using the tree operator restriction, it is possible that the resulting rowset will contain duplicate rows. For example, suppose that the nontree restrictions select two members that are siblings of each other. The tree restriction is MDTREEOP_SIBLINGS. This will cause the list of siblings to be repeated in the resulting rowset because the list of siblings was specified twice.
1998-2001 Microsoft Corporation. All rights reserved.