Purpose: Print SELECT statement.
Responsibilities:
| Modifier and Type | Field and Description |
|---|---|
| protected Expression | |
| protected DatabaseTable | |
| protected int | |
| protected ReadAllQuery. | |
| protected short | distinctState
Used for "Select Distinct" option. |
| protected Map | fieldAliases
Used for caching the field alias written to the query |
| protected int | fieldCounter
Counter to generate unique alias names |
| protected Vector | fields
Fields being selected (can include expressions). |
| protected ForUpdateClause | forUpdateClause
Used for pessimistic locking ie. |
| protected List | groupByExpressions
Group by clause for report queries. |
| protected Expression | havingExpression
Having clause for report queries. |
| protected boolean | isAggregateSelect
Used for report query or counts so we know how to treat distincts. |
| protected DatabaseTable | |
| protected List | nonSelectFields
Fields not being selected (can include expressions). |
| protected Map | optimizedClonedExpressions
It is used by subselect to re-normalize joins |
| protected List | orderByExpressions
Order by clause for read all queries. |
| protected List | |
| protected List | outerJoinExpressionHolders
Used for DB2 style from clause outer joins. |
| protected SQLSelectStatement | parentStatement
Used for subselects. |
| protected ReadQuery | query
Query this statement is associated to (used for SQL query options). |
| protected boolean | requiresAliases
Variables used for aliasing and normalizing. |
| protected boolean | |
| protected Expression | startWithExpression
Used for Oracle Hierarchical Queries |
| protected Map | |
| protected List | tables
Tables being selected from. |
| protected List | unionExpressions
Union clause. |
| protected boolean | useUniqueFieldAliases
Flag used to indicate field names should use unique aliases |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | addOptimizedClonedExpressions(Expression originalKey, Expression optimizedValue)
INTERNAL: It is used by subqueries to avoid duplicate joins. |
| protected void | addOrderByExpressionToSelectForDistinct()
When distinct is used with order by the ordered fields must be in the select clause. |
| public Integer | addOuterJoinExpressionsHolders(ObjectExpression
- expression resulting in the outerjoin. Null if it is for inheritance reading of subclasses joinExpression, Expression - used for querykey mapping expressions outerJoinedMappingCriteria, Map<DatabaseTable, Expression> - additional tables/expressions to join. Usually for multitableInheritance join expressions outerJoinedAdditionalJoinCriteria, ClassDescriptor - descriptor to use if this is for reading in subclasses in one query. descriptor)INTERNAL: Used by ExpressionBuilder and QueryKeyExpression normalization to create a standard outerjoin. |
| public Integer | addOuterJoinExpressionsHolders(Map<DatabaseTable, Expression> outerJoinedAdditionalJoinCriteria, ClassDescriptor descriptor)
INTERNAL: used by TREAT to add in a join from the parent table to the child tables when the parent expression did not add an outer join of its own |
| public void | |
| public void | appendForUpdateClause(ExpressionSQLPrinter printer)
This method will append the for update clause to the end of the select statement. |
| public void | appendFromClauseForInformixOuterJoin(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases)
ADVANCED: If a platform is Informix, then the outer join must be in the FROM clause. |
| public void | appendFromClauseForOuterJoin(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases, Collection<E> aliasesOfTablesToBeLocked, boolean shouldPrintUpdateClauseForAllTables)
ADVANCED: Appends the SQL standard outer join clause, and some variation per platform. |
| public void | |
| public void | appendGroupByClauseToWriter(ExpressionSQLPrinter printer)
This method will append the group by clause to the end of the select statement. |
| public void | appendHierarchicalQueryClauseToWriter(ExpressionSQLPrinter printer)
This method will append the Hierarchical Query Clause to the end of the select statement |
| public void | appendOrderClauseToWriter(ExpressionSQLPrinter printer)
This method will append the order clause to the end of the select statement. |
| public void | appendUnionClauseToWriter(ExpressionSQLPrinter printer)
This method will append the union clause to the end of the select statement. |
| public void | |
| public DatabaseCall | buildCall(AbstractSession session, DatabaseQuery query)
Build the call, setting the query first, this is required in some cases when the query info is required to print the SQL. |
| public DatabaseCall | buildCall(AbstractSession session)
Implements abstract org. |
| public void | computeDistinct()
INTERNAL: This is used by cursored stream to determine if an expression used distinct as the size must account for this. |
| public void | |
| public void | computeTablesFromTables()
If there is no where clause, alias the tables from the tables list directly. |
| public void | |
| public void | |
| protected boolean | fieldsContainField(List<E> fields, Expression expression)
Check if the field from the field expression is already contained in the select clause of the statement. |
| public String | |
| public String | |
| public Expression | |
| public int | |
| public ReadAllQuery. | |
| public Vector | |
| protected ForUpdateClause | |
| public List | |
| public Expression | |
| public int | |
| public List | |
| public Map | |
| public List | |
| public List | |
| public List | getOuterJoinExpressionsHolders()
INTERNAL: returns outerJoinExpressionHolders representing outerjoin expressions. |
| public SQLSelectStatement | |
| public ReadQuery | |
| public Expression | |
| public Map | |
| public List | |
| public List | |
| public boolean | getUseUniqueFieldAliases()
INTERNAL: Return True if unique field aliases will be generated of the form "fieldname AS fieldnameX", False otherwise. |
| protected boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public static SortedSet | mapTableIndexToExpression(Expression expression, TreeMap<K, V> map, List<DatabaseTable> tablesInOrder)
INTERNAL: The method searches for expressions that join two tables each in a given expression. |
| public static Map | mapTableToExpression(Expression expression, Vector<E> tablesInOrder)
INTERNAL: The method searches for expressions that join two tables each in a given expression. |
| public final void | normalize(AbstractSession session, ClassDescriptor descriptor)
INTERNAL: Normalize an expression into a printable structure. |
| public void | normalize(AbstractSession session, ClassDescriptor descriptor, Map<K, V>
With 2612185 allows additional expressions
from multiple bases to be rebuilt on the correct cloned base. clonedExpressions)INTERNAL: Normalize an expression into a printable structure. |
| public void | normalizeForView(AbstractSession theSession, ClassDescriptor theDescriptor, Map<K, V> clonedExpressions)
INTERNAL: Normalize an expression mapping all of the descriptor's tables to the view. |
| protected void | normalizeOrderBy(Expression builder, List<Expression> allExpressions, Map<Expression, Expression> clonedExpressions, AbstractSession session)
Check the order by for object expressions. |
| protected void | printForUpdateClauseOnJoin(DatabaseTable alias, ExpressionSQLPrinter printer, boolean shouldPrintUpdateClauseForAllTables, Collection<E> aliasesOfTablesToBeLocked, DatabasePlatform platform)
Print the FOR UPDATE clause after each join if required. |
| protected void | printOnClause(Expression onClause, ExpressionSQLPrinter printer, DatabasePlatform platform)
Print the outer join ON clause. |
| public Vector | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public Vector | |
| public void | |
| public void | |
| public void | |
| public void | rebuildAndAddExpressions(List<E> expressions, List<E> allExpressions, ExpressionBuilder primaryBuilder, Map<K, V> clonedExpressions)
Rebuild the expressions with the correct expression builder if using a different one. |
| public void | rebuildAndAddExpressions(Map<K, V> expressions, Vector<E> allExpressions, ExpressionBuilder primaryBuilder, Map<K, V> clonedExpressions)
Rebuild the expressions with the correct expression builder if using a different one. |
| public Expression | rebuildExpression(Expression expression, Expression primaryBuilder, Map<Expression, Expression> clonedExpressions)
Rebuild the expression if required. |
| public void | |
| public void | |
| public boolean | |
| public void | |
| public void | |
| public void | setCurrentAliasNumber(int currentAliasNumber)
Sets a unique id that will be used to alias the next table. |
| public void | setDistinctState(short distinctState)
ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
| public void | |
| protected void | |
| public void | |
| public void | |
| public void | setHierarchicalQueryExpressions(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions)
INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQL |
| public void | setHierarchicalQueryExpressions(Expression startWith, Expression connectBy, List<Expression> orderSiblingsExpressions, ReadAllQuery.
INTERNAL: takes the hierarchical query expression which have been set on the query and sets them here used to generate the Hierarchical Query Clause in the SQL |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| protected void | |
| public void | |
| public void | |
| public void | setUseUniqueFieldAliases(boolean useUniqueFieldAliases)
INTERNAL: If set unique field aliases will be generated of the form "fieldname AS fieldnameX" Where fieldname is the column name and X is an incremental value ensuring uniqueness |
| private boolean | |
| public boolean | |
| protected void | |
| public void | |
| protected void | |
| protected void | writeFieldsFromExpression(ExpressionSQLPrinter printer, Expression expression, Vector<DatabaseField> newFields)
INTERNAL: |
| protected Vector |