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

IDSSSQLQuery Interface Reference

Inherited by IDSSSQLQuery2.

List of all members.

Public Member Functions

HRESULT BuildJoinTree ()
 Build or refresh the JoinTree based on the JoinList.
HRESULT CalculateGroupBy ()
HRESULT Having ([out, retval] IDSSExpression oppExpression)
 Expression representing the Having clause condition.
HRESULT ID ([out, retval] BSTR *opID)
HRESULT Index ([out, retval] Int32 *opIndex)
 the index of this SQLQuery in the SQLQueries collection
HRESULT JoinList ([out, retval] IDSSSQLJoins oppSQLJoins)
 Collection of IDSSSQLJoin objects.
HRESULT JoinOrderIgnored ([in] VARIANT_BOOL iValue)
 Put whether the join order in the JoinList should be considered or ignored.
HRESULT JoinOrderIgnored ([out, retval] VARIANT_BOOL *opValue)
 Get whether the join order in the JoinList should be considered or ignored.
HRESULT JoinTree ([out, retval] IDSSSQLJoinTreeNode oppSQLJoinTreeNode)
 The root of the join tree.
HRESULT LookupSymbol ([in] BSTR iSymbol,[in] VARIANT_BOOL iSearchSQLQuery,[out] IDispatch oppResult1,[out] IDispatch oppResult2)
 lookup a symbol in the SQLQuery.
HRESULT Name ([in] BSTR iName)
HRESULT Name ([out, retval] BSTR *opName)
HRESULT OperationType ([in] EnumDSSSQLOperationType iType)
 Put the operation type of the SQL query.
HRESULT OperationType ([out, retval] EnumDSSSQLOperationType *opType)
 Get the operation type of the SQL query.
HRESULT SelectDistinct ([in] VARIANT_BOOL iFlag)
 if this property is set to VARIANT_TRUE and the SQL operation type is SELECT, then a SELECT DISTINCT statement is generated.
HRESULT SelectDistinct ([out, retval] VARIANT_BOOL *opFlag)
 if this property is set to VARIANT_TRUE and the SQL operation type is SELECT, then a SELECT DISTINCT statement is generated.
HRESULT SetOperator ([in] EnumDSSSQLSetOperator iOperator)
 the set operator to use when the OperationType is SET operation If more than 2 tables exists in the SQLTables collection, the same operator is applied to all of them.
HRESULT SetOperator ([out, retval] EnumDSSSQLSetOperator *opOperator)
 the set operator to use when the OperationType is SET operation If more than 2 tables exists in the SQLTables collection, the same operator is applied to all of them.
HRESULT SQLQueryColumns ([out, retval] IDSSSQLQueryColumns oppColumns)
 Collection of IDSSSQLQueryColumn objects representing the items in the Select, Group By and Order By lists.
HRESULT SQLTables ([out, retval] IDSSSQLTables oppSQLTables)
 Collection of IDSSSQLTable objects representing the actual tables or SQL Queries used in the SQL Query.
HRESULT Where ([out, retval] IDSSExpression oppExpression)
 Expression representing the Where clause condition.


Member Function Documentation

HRESULT IDSSSQLQuery::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 SQLJoinTreeLeafNodes from the 2 tables and a new SQLJoinTreeBranchNode 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 SQLJoinTreeLeafNode from the separate table and a new SQLJoinTreeBranchNode on top of the new leaf and the SQLJoinTreeBranchNode 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 SQLJoinTreeBranchNode on top of the 2 existing SQLJoinTreeBranchNodes 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.
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::CalculateGroupBy  ) 
 

HRESULT IDSSSQLQuery::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).

Parameters:
oppExpression the expression that appears in the Having clause of a Select statement
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::ID [out, retval] BSTR *  opID  ) 
 

HRESULT IDSSSQLQuery::Index [out, retval] Int32 *  opIndex  ) 
 

the index of this SQLQuery in the SQLQueries collection

Parameters:
opIndex the index
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::JoinList [out, retval] IDSSSQLJoins   oppSQLJoins  ) 
 

Collection of IDSSSQLJoin objects.

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

Parameters:
oppSQLJoins Collection of joins
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::JoinOrderIgnored [in] VARIANT_BOOL  iValue  ) 
 

Put whether the join order in the JoinList 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").

Returns:
Usual COM result code:
  • S_OK

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

Get whether the join order in the JoinList 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"). The initial value is VARIANT_FALSE

Parameters:
opValue a boolean value indicating whether the join order should be ignored.
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::JoinTree [out, retval] IDSSSQLJoinTreeNode   oppSQLJoinTreeNode  ) 
 

The root of the join tree.

The join tree is built by the BuildJoinTree method.

Parameters:
oppSQLJoinTreeNode the newly created JoinTree by the BuildJoinTree method
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::LookupSymbol [in] BSTR  iSymbol,
[in] VARIANT_BOOL  iSearchSQLQuery,
[out] IDispatch   oppResult1,
[out] IDispatch   oppResult2
 

lookup a symbol in the SQLQuery.

The result could be a SQLQuery object, a SQLQueryColumn object, or a <SQLTable, Column> pair.

Parameters:
iSymbol the string of the symbol to lookup.
iSearchSQLQuery a flag specifying if the lookup should match the symbol with a SQLQuery name.
oppResult1 if the symbol matches the name of a SQLQuery or the alias of a SQLQueryColumn, this value is the pointer to the corresponding object. If the symbol matches a <SQLTable, Column> pair, this value holds the pointer to the SQLTable object.
oppResult2 if the symbol matches a <SQLTable, Column> pair, this value holds the pointer the Column. Otherwise the value is NULL.

HRESULT IDSSSQLQuery::Name [in] BSTR  iName  ) 
 

HRESULT IDSSSQLQuery::Name [out, retval] BSTR *  opName  ) 
 

HRESULT IDSSSQLQuery::OperationType [in] EnumDSSSQLOperationType  iType  ) 
 

Put the operation type of the SQL query.

Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::OperationType [out, retval] EnumDSSSQLOperationType opType  ) 
 

Get the operation type of the SQL query.

Here the list of EnumDSSSQLOperationType enumeration possible for this property
Constant Value Comment
DssSQLOperationTypeUnknown -1 Unknown data type
DssSQLOperationTypeReserved 0 Reserved (invalid) datatype
DssSQLOperationTypeSelect 1 Select operation, e.g., SELECT ... FROM
DssOperationTypeSet 2 Set operation, e.g., ... UNION ...
The initial value is DssSQLOperationTypeSelect
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SelectDistinct [in] VARIANT_BOOL  iFlag  ) 
 

if this property is set to VARIANT_TRUE and the SQL operation type is SELECT, then a SELECT DISTINCT statement is generated.

Parameters:
iFlag whether the DISTINCT property to be added to the select statement
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SelectDistinct [out, retval] VARIANT_BOOL *  opFlag  ) 
 

if this property is set to VARIANT_TRUE and the SQL operation type is SELECT, then a SELECT DISTINCT statement is generated.

The default value is VARIANT_FALSE.

Parameters:
opFlag whether the DISTINCT property to be added to the select statement
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SetOperator [in] EnumDSSSQLSetOperator  iOperator  ) 
 

the set operator to use when the OperationType is SET operation If more than 2 tables exists in the SQLTables collection, the same operator is applied to all of them.

The initial value is

Parameters:
iOperator a EnumDSSSetOperatorType value
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SetOperator [out, retval] EnumDSSSQLSetOperator opOperator  ) 
 

the set operator to use when the OperationType is SET operation If more than 2 tables exists in the SQLTables collection, the same operator is applied to all of them.

Parameters:
opOperator a EnumDSSSetOperatorType value
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SQLQueryColumns [out, retval] IDSSSQLQueryColumns   oppColumns  ) 
 

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

Parameters:
oppColumns Collection of QueryColumn objects
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::SQLTables [out, retval] IDSSSQLTables   oppSQLTables  ) 
 

Collection of IDSSSQLTable objects representing the actual tables or SQL Queries used in the SQL Query.

Parameters:
oppSQLTables Collection of tables or SQL Queries
Returns:
Usual COM result code:
  • S_OK

HRESULT IDSSSQLQuery::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.
  • SQLQueryShortcut (referring to an IDSSSQLQuery object)
  • SQLQueryColumnShortcut (referring to an IDSSSQLQueryColumn object)
  • SQLColumnShortcut (referring to an IDSSSQLColumn object)
  • 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).
    Parameters:
    oppExpression the expression that appears in the Where clause of the SQL statement
    Returns:
    Usual COM result code:
  • S_OK


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