MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 22: OLE DB for OLAP Objects and Schema Rowsets


 

Restrictions

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 SELF operator includes the row for the member itself in the list of returned rows. The following constants for tree operations are defined in the header file:

These designations comprise a bitmask and can be combined.

Effect of Multiple Restrictions

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:

  1. All restrictions other than the tree operator are joined by an AND operation and applied to the MEMBERS rowset to get the members.

  2. The tree operator is then applied to these members to yield the required rows.

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.

Possibility of Duplicates

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.