Restrictions in the MEMBERS Rowset

OLE DB Programmer's Reference

The MEMBERS rowset can have up to 12 restrictions. The first 11 are the columns in the MEMBERS rowset:

  • CATALOG_NAME
  • SCHEMA_NAME
  • CUBE_NAME
  • DIMENSION_UNIQUE_NAME
  • HIERARCHY_UNIQUE_NAME
  • LEVEL_UNIQUE_NAME
  • LEVEL_NUMBER
  • MEMBER_NAME
  • MEMBER_UNIQUE_NAME
  • MEMBER_CAPTION
  • MEMBER_TYPE

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.

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.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

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