| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.datatools.sqltools.sqlbuilder.model.SelectHelper
public class SelectHelper
Helper class for SelectStatement
| Constructor Summary | |
|---|---|
| SelectHelper() | |
| Method Summary | |
|---|---|
| static void | addOrderByColumn(QuerySelectStatement selectStmt,
                 QueryValueExpression anExpr,
                 java.lang.String sortType,
                 int position)Adds a QueryValueExpression to the Order by clause of a QuerySelectStatement | 
| static void | addResultColumn(QuerySelectStatement selectStmt,
                ResultColumn aResultColumn,
                java.lang.String alias,
                int index)Adds a column to to the select statement's result columns list | 
| static void | addTableToStatement(QuerySelectStatement stmt,
                    TableExpression tableExpr)Adds the given table expression to list of tables for a select statement. | 
| static void | addTableToStatement(QuerySelect qSelect,
                    TableExpression tableExpr)Adds the given table expression to list of tables for a select statement. | 
| static void | addTableToStatementAtPosition(SQLQueryObject stmt,
                              TableExpression tableExpr,
                              int position) | 
| static OrderByValueExpression | appendOrderByColumn(QuerySelectStatement selectStmt,
                    QueryValueExpression colExpr,
                    java.lang.String sortType)Creates the OrderByValueExpression column for "Order By" clause from the given value expression if not already exists and appends it to Order By list. | 
| static OrderByResultColumn | appendOrderByColumn(QuerySelectStatement selectStmt,
                    ResultColumn resCol,
                    java.lang.String alias,
                    java.lang.String sortType)Creates the OrderByResultColumn column for "Order By" clause from the given ResultColumn if not already exists and appends it to Order By list. | 
| static ResultColumn | appendResultColumn(SQLQueryObject selectStmt,
                   QueryValueExpression colExpr,
                   java.lang.String alias)Creates the Result column from the given ValueExpression and appends it to the select column list in the given Select statement. | 
| static ResultColumn | appendResultColumn(SQLQueryObject selectStmt,
                   ResultColumn resCol,
                   java.lang.String alias)Appends the given ResultColumn to the select column list in the given Select statement. | 
| static void | clearStatementContents(QuerySelectStatement stmt)Clears the contents of the given Select statement.Containments which are objects, are set to null and containments which are lists, are cleared. | 
| static GroupingExpression | createGroupingExpression(QueryValueExpression valExpr)Creates the GroupingExpression and set the given ValueExpression | 
| static GroupingSets | createGroupingSets()Creates the GroupingSets. | 
| static GroupingSetsElementExpression | createGroupingSetsElementExpression()Creates the GroupingSetsElementExpression | 
| static GroupingSetsElementExpression | createGroupingSetsElementExpression(QueryValueExpression valExpr)Creates the GroupingSetsElementExpression and set the given ValueExpression | 
| static GroupingSetsElementSublist | createGroupingSetsElementSublist()Creates the GroupingSetsElementSublist | 
| static SuperGroup | createSuperGroup(int superGroupType)Creates the SuperGroup and sets the given type. | 
| static SuperGroupElementExpression | createSuperGroupElementExpression(QueryValueExpression valExpr)Creates the SuperGroupElementExpression and set the given ValueExpression | 
| static SuperGroupElementSublist | createSuperGroupElementSublist()Creates the SuperGroupElementSublist. | 
| static WithTableSpecification | createWithTableSpecification()Creates the WithTableSpecification. | 
| static java.lang.String | getCombinedOperatorSQLString(java.lang.String inString) | 
| static java.lang.String | getCombinedOperatorStringConstant(java.lang.String inString)Returns a string to create a QueryCombinedOperator,based on the given string, which is the SQL of the operator | 
| static int | getOrderByColIndexFromValueExpr(SQLQueryObject selectStmt,
                                QueryValueExpression searchValExpr)Returns the position of the column that matches the given ValueExpression in the order by column list. | 
| static QueryExpressionBody | getQueryExpressionBody(QuerySelectStatement stmt)Returns the QueryExpressionBody from the Select statement | 
| static QuerySelect | getQuerySelect(QuerySelectStatement stmt)Returns the QuerySelect from the Select statement | 
| static QuerySelectStatement | getQuerySelectStatement(QueryExpressionBody queryExprBody)Returns the QuerySelectStatement whose QueryExpressionRoot contain the given QueryExpressionBody object | 
| static ValueExpressionColumn | getSelectColumnFromColumnName(SQLQueryObject selectStmt,
                              java.lang.String columnName)Looks for a ValueExpressionColumn in the list of assignment select columns in the given statement, with name same as the given name | 
| static boolean | hasChild(QueryCombined node)Checks if the given QueryCombined object has either a left side child or a right side child. | 
| static void | initSelectStmt(QuerySelectStatement stmt)Creates the Query Select and appends it to QueryExpressionRoot. | 
| static boolean | isNodeFull(QueryCombined node)Checks if the given QueryCombined object's left and right children are set. | 
| static boolean | isResultColumn(QuerySelect qSelect,
               ResultColumn resCol)Returns true if the give ResultColumn is part of the given select. | 
| static boolean | isResultColumn(QuerySelect qSelect,
               ValueExpressionColumn resColExpr)Returns true if the give ValueExpression is part of the given query select's result columns. | 
| static boolean | isResultColumn(SQLQueryObject selectStmt,
               ResultColumn resCol)Returns true if the give ResultColumn is part of the given select statement. | 
| static boolean | isResultColumn(SQLQueryObject selectStmt,
               ValueExpressionColumn resColExpr)Returns true if the give ValueExpression is part of the given select statement's result columns. | 
| static boolean | isSelectStarQuery(QuerySelect querySelect)Gets whether or not the given QuerySelect object is a "select *" query. | 
| static boolean | moveColumnInStatement(QuerySelectStatement selectStmt,
                      ResultColumn aResultColumn,
                      int movePosition)Moves a column in the selectClause to another position (ie new index) in the List. | 
| static boolean | moveOrderByInStatement(QuerySelectStatement selectStmt,
                       OrderBySpecification anExpr,
                       int movePosition)Moves a column in the order by clause to another position (ie new index in the list). | 
| static void | moveOrderByToPosition(OrderBySpecification orderBy,
                      java.util.List orderByList,
                      int position)Moves the given OrderBySpecification to the gievn position in the given List containing it | 
| static void | refresh(QuerySelect stmt)Refreshes the model that ultimately refreseh the UI, this is temporary. | 
| static void | refresh(QuerySelectStatement stmt)Refreshes the model that ultimately refreseh the UI, this is temporary. | 
| static void | refresh(SQLQueryObject stmt)Refreshes the model that ultimately refreseh the UI, this is temporary. | 
| static void | removeAllColumnFromOrderBy(QuerySelectStatement selectStmt,
                           QueryValueExpression sqlExpr)Removes the order by column that contains the given value expression from the given statement. | 
| static void | removeAllColumnFromResultColumns(SQLQueryObject selectStmt,
                                 QueryValueExpression sqlExpr)Removes the result column that contains the given ValueExpression from the given statement. | 
| static void | removeColFunctionsForTable(SQLQueryObject selectStmt,
                           TableReference aRef)Removes the functions from the result columns whose parameters use columns in the table that is being removed. | 
| static void | removeColumnFromOrderBy(SQLQueryObject selectStmt,
                        QueryValueExpression sqlExpr)Removes the order by column that contains the given value expression from the given statement. | 
| static void | removeColumnFromOrderBy(SQLQueryObject selectStmt,
                        ResultColumn resCol)Removes the order by column that contains the given ResultColumn from the given statement. | 
| static void | removeColumnFromResultColumns(SQLQueryObject selectStmt,
                              QueryValueExpression sqlExpr)Removes the result column that contains the given ValueExpression from the given statement. | 
| static boolean | removeTableFromStatement(QuerySelectStatement stmt,
                         TableExpression tableExpr)Removes the table from the given Select statement | 
| static boolean | replaceColumnValueExpr(QuerySelectStatement selectStmt,
                       ResultColumn resCol,
                       QueryValueExpression newValExpr)Replaces the value expression in the given result column of a statement. | 
| static boolean | replaceColumnValueExpr(SQLQueryObject selectStmt,
                       ResultColumn resCol,
                       QueryValueExpression newValExpr)Replaces the value expression in the given result column of a statement. | 
| static boolean | replaceColumnValueExprForOrderBy(QuerySelectStatement selectStmt,
                                 ResultColumn resCol,
                                 QueryValueExpression newValExpr)Replaces the value expression of the Order By column that matches the value expression of the given result column of a statement. | 
| static void | replaceStatementContents(QuerySelectStatement oldStmt,
                         QuerySelectStatement newStmt)Replaces contents of the statement from the given new statement | 
| static boolean | repositionColumnInOrderBy(SQLQueryObject selectStmt,
                          QueryValueExpression sqlExpr,
                          int position)Repositions the order by column that contains the given value expression in the given statement. | 
| static void | setChildForQueryCombined(QueryCombined combined,
                         QueryExpressionBody child)Sets the given QueryExpressionBody object as a child of the given Querycombined object. | 
| static void | setResultColumnAlias(ResultColumn resultColumn,
                     java.lang.String alias)Assigns the alias to the given result column. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public SelectHelper()
| Method Detail | 
|---|
public static void refresh(QuerySelectStatement stmt)
stmt - the QuerySelectStatement which needs to be refreshedpublic static void refresh(QuerySelect stmt)
stmt - the QuerySelect which needs to be refreshedpublic static void refresh(SQLQueryObject stmt)
stmt - the SQLQueryObject which needs to be refreshed
public static void moveOrderByToPosition(OrderBySpecification orderBy,
                                         java.util.List orderByList,
                                         int position)
orderBy - the OrderBySpecificationorderByList - the List containing the OrderBySpecificationposition - the position in the list to which the OrderBySpecification is to be moved
public static void addTableToStatementAtPosition(SQLQueryObject stmt,
                                                 TableExpression tableExpr,
                                                 int position)
public static void addTableToStatement(QuerySelectStatement stmt,
                                       TableExpression tableExpr)
stmt - the QuerySelectStatement in which table needs to be addedtableExpr - the TableExpression which needs to be added
public static void addTableToStatement(QuerySelect qSelect,
                                       TableExpression tableExpr)
qSelect - the QuerySelect in which table needs to be addedtableExpr - the TableExpression which needs to be added
public static void setChildForQueryCombined(QueryCombined combined,
                                            QueryExpressionBody child)
combined - the QueryCombinedchild - the QueryExpressionbody objectpublic static boolean isNodeFull(QueryCombined node)
node - the QueryCombined object
public static boolean hasChild(QueryCombined node)
node - the QueryCombined object
public static void initSelectStmt(QuerySelectStatement stmt)
stmt - the QuerySelectStatement in which table needs to be added
public static boolean removeTableFromStatement(QuerySelectStatement stmt,
                                               TableExpression tableExpr)
stmt - the QuerySelectStatement from which table needs to be removedtableExpr - the TableExpression which needs to be removed
public static void clearStatementContents(QuerySelectStatement stmt)
stmt - the statement being modified
public static void replaceStatementContents(QuerySelectStatement oldStmt,
                                            QuerySelectStatement newStmt)
oldStmt - the QuerySelectStatement that needs to be refreshednewStmt - the QuerySelectStatement from which contents needs to be replacedpublic static QueryExpressionBody getQueryExpressionBody(QuerySelectStatement stmt)
stmt - the QuerySelectStatement from which QuerySelect needs tobe returned
public static QuerySelectStatement getQuerySelectStatement(QueryExpressionBody queryExprBody)
queryExprBody - the QueryExpressionBody
public static java.lang.String getCombinedOperatorStringConstant(java.lang.String inString)
inString - 
public static java.lang.String getCombinedOperatorSQLString(java.lang.String inString)
public static QuerySelect getQuerySelect(QuerySelectStatement stmt)
stmt - the QuerySelectStatement from which QuerySelect needs tobe returned
public static ResultColumn appendResultColumn(SQLQueryObject selectStmt,
                                              QueryValueExpression colExpr,
                                              java.lang.String alias)
selectStmt - the QuerySelectStatement to which new column needs to addedcolExpr - the given ValueExpression for the columnalias - the Sting value for the alias name of the column
public static ResultColumn appendResultColumn(SQLQueryObject selectStmt,
                                              ResultColumn resCol,
                                              java.lang.String alias)
selectStmt - the QuerySelectStatement to which new column needs to addedresCol - the given ResultColumn that needs to be addedalias - the Sting value for the alias name of the column
public static OrderByValueExpression appendOrderByColumn(QuerySelectStatement selectStmt,
                                                         QueryValueExpression colExpr,
                                                         java.lang.String sortType)
selectStmt - the QuerySelectStatement to which new Order By column needs to addedcolExpr - the given ValueExpression for the Order By columnsortType - the sort order for the column, it can be ASC or DESC
public static OrderByResultColumn appendOrderByColumn(QuerySelectStatement selectStmt,
                                                      ResultColumn resCol,
                                                      java.lang.String alias,
                                                      java.lang.String sortType)
selectStmt - the QuerySelectStatement to which new Order By column needs to addedresCol - the given ResultColumn that needs to be added to the Order By columnalias - the Sting value for the alias name of the columnsortType - the sort order for the column, it can be ASC or DESC
public static boolean isResultColumn(SQLQueryObject selectStmt,
                                     ResultColumn resCol)
selectStmt - the given QuerySelectStatementresCol - the given ResultColumn that needs to be find in the given select statement
public static boolean isResultColumn(QuerySelect qSelect,
                                     ResultColumn resCol)
qSelectStmt - the given QuerySelectresCol - the given ResultColumn that needs to be find in the given select statement
public static boolean isResultColumn(SQLQueryObject selectStmt,
                                     ValueExpressionColumn resColExpr)
selectStmtselectStmt - the given QuerySelectStatementresColExpr - the given ValueExpression that needs to be find in the given select statement
public static boolean isResultColumn(QuerySelect qSelect,
                                     ValueExpressionColumn resColExpr)
qSelect - the given QuerySelectresColExpr - the given ValueExpression that needs to be find in the given select statement
public static boolean isSelectStarQuery(QuerySelect querySelect)
querySelect - the QuerySelect to check
public static boolean moveColumnInStatement(QuerySelectStatement selectStmt,
                                            ResultColumn aResultColumn,
                                            int movePosition)
selectStmt - the QuerySelectStatement that the column belongs toaResultColumn - the ResultColumn that needs to be movedmovePosition - the position to be moved.  
 -1 moves the column up one position (newIndex = oldIndex -1) +1 moves the column down one position
public static void addResultColumn(QuerySelectStatement selectStmt,
                                   ResultColumn aResultColumn,
                                   java.lang.String alias,
                                   int index)
selectStmt - the QuerySelectStatement object that the column is addedaResultColumn - the ResultColumn object to be addedindex - the index of the columns list to add to
public static void addOrderByColumn(QuerySelectStatement selectStmt,
                                    QueryValueExpression anExpr,
                                    java.lang.String sortType,
                                    int position)
selectStmt - the QueryValueExpression object containing the Order by
 clause that the QueryValueExpression is to be added toanExpr - the QueryValueExpression to be addedsortType - the sorttypeposition - the position in the order by clause to be inserted
public static boolean moveOrderByInStatement(QuerySelectStatement selectStmt,
                                             OrderBySpecification anExpr,
                                             int movePosition)
selectStmt - the QuerySelectStatement holding the order by clauseanExpr - the OrderBySpecification object to movemovePosition - the number of places to move
 -1 moves the column up one position (newIndex = oldIndex -1) +1 moves the column down one position
public static void removeColumnFromResultColumns(SQLQueryObject selectStmt,
                                                 QueryValueExpression sqlExpr)
selectStmt - the given QuerySelectStatement from which column needs to be removedsqlExpr - the ValueExpression which needs to be matched
public static void removeColumnFromOrderBy(SQLQueryObject selectStmt,
                                           ResultColumn resCol)
selectStmt - the give QuerySelectStatement from which column needs to be removedresCol - the ResultColumn which needs to be matched
public static void removeColumnFromOrderBy(SQLQueryObject selectStmt,
                                           QueryValueExpression sqlExpr)
selectStmt - the give QuerySelectStatement from which column needs to be removedsqlExpr - the Value Expression which needs to be matched
public static boolean repositionColumnInOrderBy(SQLQueryObject selectStmt,
                                                QueryValueExpression sqlExpr,
                                                int position)
selectStmt - the give QuerySelectStatement from which column needs to be removedsqlExpr - the Value Expression which needs to be matchedposition - the new position for the column
public static boolean replaceColumnValueExpr(QuerySelectStatement selectStmt,
                                             ResultColumn resCol,
                                             QueryValueExpression newValExpr)
selectStmt - the QuerySelectStatement of which the result column is part ofresCol - the given ResultColum for which new ValueExpression needs to be replacednewValExpr - the new QueryValueExpression that needs to be assigned
public static boolean replaceColumnValueExpr(SQLQueryObject selectStmt,
                                             ResultColumn resCol,
                                             QueryValueExpression newValExpr)
selectStmt - the SQLQueryObject of which the result column is part ofresCol - the given ResultColum for which new ValueExpression needs to be replacednewValExpr - the new QueryValueExpression that needs to be assigned
public static boolean replaceColumnValueExprForOrderBy(QuerySelectStatement selectStmt,
                                                       ResultColumn resCol,
                                                       QueryValueExpression newValExpr)
selectStmt - the QuerySelectStatement that contain the order byresCol - the ResultColumn that needs to be matched withnewValExpr - the new ValueExpression
public static int getOrderByColIndexFromValueExpr(SQLQueryObject selectStmt,
                                                  QueryValueExpression searchValExpr)
selectStmt - the given QuerySelectStatement that contains the order bysearchValExpr - the ValueExpression that needs to be searched
public static void setResultColumnAlias(ResultColumn resultColumn,
                                        java.lang.String alias)
resultColumn - the ResultColumn for which alias needs to be setalias - the String value for the alias
public static ValueExpressionColumn getSelectColumnFromColumnName(SQLQueryObject selectStmt,
                                                                  java.lang.String columnName)
statement - the statement on which the search needs to be performedcolumnName - the name of the ValueExpressionColumn to search for
public static void removeAllColumnFromOrderBy(QuerySelectStatement selectStmt,
                                              QueryValueExpression sqlExpr)
selectStmt - the give QuerySelectStatement from which column needs to be removedsqlExpr - the Value Expression which needs to be matched
public static void removeAllColumnFromResultColumns(SQLQueryObject selectStmt,
                                                    QueryValueExpression sqlExpr)
selectStmt - the given QuerySelectStatement from which column needs to be removedsqlExpr - the ValueExpression which needs to be matched
public static void removeColFunctionsForTable(SQLQueryObject selectStmt,
                                              TableReference aRef)
selectStmt - the given QuerySelectStatement from which column needs to be removedaRef - the TableReference that is being removedpublic static GroupingExpression createGroupingExpression(QueryValueExpression valExpr)
valExpr - the ValueExpression that needs to be set in the new GroupingExpressing
public static SuperGroup createSuperGroup(int superGroupType)
superGroupType - the Int type of the new SuperGroup.
public static SuperGroupElementExpression createSuperGroupElementExpression(QueryValueExpression valExpr)
valExpr - the ValueExpression that needs to be set in the new SuperGroupElementExpression
public static SuperGroupElementSublist createSuperGroupElementSublist()
public static GroupingSets createGroupingSets()
public static GroupingSetsElementExpression createGroupingSetsElementExpression(QueryValueExpression valExpr)
valExpr - the ValueExpression that needs to be set in the new GroupingSetsElementExpression
public static GroupingSetsElementExpression createGroupingSetsElementExpression()
public static GroupingSetsElementSublist createGroupingSetsElementSublist()
public static WithTableSpecification createWithTableSpecification()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||