Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

IDSSCustomSQLQueryBuilder Interface Reference

List of all members.

Public Member Functions

HRESULT BuildJoinTree ()
 Build or refresh the JoinTree based on the JoinList.
HRESULT Having ([out, retval] IDSSExpression oppExpression)
 Expression representing the Having clause condition.
HRESULT JoinList ([out, retval] IDSSQBJoins oppQBJoins)
 Collection of IDSSQBJoin objects.
HRESULT JoinOrderIgnored ([in] VARIANT_BOOL iValue)
 Put whether the join order specified by the user should be considered or ignored.
HRESULT JoinOrderIgnored ([out, retval] VARIANT_BOOL *opValue)
 Get whether the join order specified by the user should be considered or ignored.
HRESULT JoinTree ([out, retval] IDSSQBJoinTreeNode oppQBJoinTreeNode)
 The root of the join tree.
HRESULT QBColumns ([out, retval] IDSSColumns oppColumns)
 Collection of IDSSColumn objects representing the actual table columns used in the custom SQL command.
HRESULT QBQueryColumns ([out, retval] IDSSColumns oppColumns)
 Collection of IDSSColumn objects representing the items in the Select, Group By and Order By lists.
HRESULT QBTables ([out, retval] IDSSQBTables oppQBTables)
 Collection of IDSSQBTable objects representing the actual tables used in the custom SQL command.
HRESULT Where ([out, retval] IDSSExpression oppExpression)
 Expression representing the Where clause condition.

Member Function Documentation

HRESULT IDSSCustomSQLQueryBuilder::BuildJoinTree  ) 
 

Build or refresh the JoinTree based on the JoinList.

The following is an informal outline of the algorithm used to construct the tree.

The input: A set ST of tables T1,..,Tn and an ordered collection CJ of Joins (edges) J1,..,Jm. We assume that each join is determined by a pair of tables (LeftTable and RightTable) from ST and a (possibly complex) condition on their columns, and that we do not have 2 separate joins on the same pair of tables.
Algorithm:
For each join Jk in CJ do:
  • If neither Jk.LeftTable nor Jk.RightTable is in a table cluster, create a new cluster that contains the 2 tables. Create 2 QBJoinTreeLeafNodes from the 2 tables and a new QBJoinTreeBranchNode on top of the 2 leaves. Use the "direction" of Jk (Left->Right table) to decide which is the left/right leaf.
  • If either Jk.LeftTable or Jk.RightTable is in a table cluster (but not both) add the isolated table to the cluster of the other one. Create one QBJoinTreeLeafNode from the separate table and a new QBJoinTreeBranchNode on top of the new leaf and the QBJoinTreeBranchNode of the other table's cluster. If the separate table has a collection C of joins to the tables in the cluster it is merged into, "perform" all the joins in C at this point (i.e. remove all related edges). Use the order between the 2 edges/joins with the minimum JoinOrder in the cluster and in C to decide which is the left/right descendent of the new branch node. Return error if the "participating" edges/joins do not have the same join type.
  • If both Jk.LeftTable and Jk.RightTable are in (separate) clusters, merge the 2 clusters into one. Create a new QBJoinTreeBranchNode on top of the 2 existing QBJoinTreeBranchNodes of the 2 existing clusters. Use the order between the 2 edges/joins with the minimum JoinOrder in each cluster to decide which is the left/right descendent of the new branch node. Return error if the "participating" edges/joins do not have the same join type.
End For
If in the end we have more than one clusters remaining, perform crossjoins on them. Determine the order of the crossjoins based on the lowest JoinOrder value from the joins in each cluster.
End.

HRESULT IDSSCustomSQLQueryBuilder::Having [out, retval] IDSSExpression   oppExpression  ) 
 

Expression representing the Having clause condition.

It must have a predicate nature, returning a True/False value. The expression is accessed through the regular IDSSExpression, IDSSNode etc. interfaces and is similar in nature to that of the Having clause (including the pass-through nodes).

HRESULT IDSSCustomSQLQueryBuilder::JoinList [out, retval] IDSSQBJoins   oppQBJoins  ) 
 

Collection of IDSSQBJoin objects.

It represents the list of "table-to-table" joins as specified by the user.

HRESULT IDSSCustomSQLQueryBuilder::JoinOrderIgnored [in] VARIANT_BOOL  iValue  ) 
 

Put whether the join order specified by the user should be considered or ignored.

When the value of this property is VARIANT_TRUE, a suggestion based on heuristics is sent to the RDBMS (including, in some cases, the passing on of "ignore order").

HRESULT IDSSCustomSQLQueryBuilder::JoinOrderIgnored [out, retval] VARIANT_BOOL *  opValue  ) 
 

Get whether the join order specified by the user should be considered or ignored.

When the value of this property is VARIANT_TRUE, a suggestion based on heuristics is sent to the RDBMS (including, in some cases, the passing on of "ignore order").

HRESULT IDSSCustomSQLQueryBuilder::JoinTree [out, retval] IDSSQBJoinTreeNode   oppQBJoinTreeNode  ) 
 

The root of the join tree.

The join tree is built by the BuildJoinTree method.

HRESULT IDSSCustomSQLQueryBuilder::QBColumns [out, retval] IDSSColumns   oppColumns  ) 
 

Collection of IDSSColumn objects representing the actual table columns used in the custom SQL command.

Each of the columns in the collection is an XDA column whose XDADefinition property returns, in this case, an IDSSQBColumn interface.

HRESULT IDSSCustomSQLQueryBuilder::QBQueryColumns [out, retval] IDSSColumns   oppColumns  ) 
 

Collection of IDSSColumn objects representing the items in the Select, Group By and Order By lists.

Each of the columns in the collection is an XDA column whose XDADefinition property returns, in this case, an IDSSQBQueryColumn interface.

HRESULT IDSSCustomSQLQueryBuilder::QBTables [out, retval] IDSSQBTables   oppQBTables  ) 
 

Collection of IDSSQBTable objects representing the actual tables used in the custom SQL command.

HRESULT IDSSCustomSQLQueryBuilder::Where [out, retval] IDSSExpression   oppExpression  ) 
 

Expression representing the Where clause condition.

It must have a predicate nature, returning a True/False value. The expression is accessed through the regular IDSSExpression, IDSSNode etc. interfaces and is based on the following types of nodes:

  • Operator (associated with an IDSSFunction), e.g. =, <, etc.
  • Shortcut (referring to an IDSSColumn that is an XDA column providing either the IDSSQBColumn or the IDSSQBQueryColumn interface) BEWARE: Revise this, add here more explanatory comments.
  • Constant
    Note: Certain string constants will have the meaning of a "pass-through" subexpression. The string corresponding to such a node (possibly the root) is passed on "as it is" to the RDBMS. (We may use for this a special name for the constant node or a special prefix in the string).


Copyright © 1996-2018 MicroStrategy Inc. All Rights Reserved.