public class DefaultSelectTranslator extends QueryAssembler implements SelectTranslator
QueryAssembler.AddBindingListener
Modifier and Type | Field and Description |
---|---|
protected static int[] |
UNSUPPORTED_DISTINCT_TYPES |
adapter, addBindingListener, bindings, entityResolver, query, queryMetadata, sql, translated
Constructor and Description |
---|
DefaultSelectTranslator(Query query,
DbAdapter adapter,
EntityResolver entityResolver) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendGroupByColumn(StringBuilder buffer,
Map.Entry<ColumnDescriptor,List<DbAttributeBinding>> entry)
Append single column to GROUP BY clause
|
protected void |
appendGroupByColumns(StringBuilder buffer,
Map<ColumnDescriptor,List<DbAttributeBinding>> groupByColumns)
Append columns to GROUP BY clause
|
protected void |
appendLimitAndOffsetClauses(StringBuilder buffer)
Handles appending optional limit and offset clauses.
|
protected void |
appendSelectColumns(StringBuilder buffer,
List<String> selectColumnExpList) |
protected String |
buildDistinctStatement()
Allows subclasses to insert their own dialect of DISTINCT statement to
improve performance.
|
protected List<ColumnDescriptor> |
buildResultColumns() |
protected JoinStack |
createJoinStack() |
void |
dbRelationshipAdded(DbRelationship relationship,
JoinType joinType,
String joinSplitAlias)
Appends a join with given semantics to the query.
|
protected void |
doTranslate() |
String |
getAliasForExpression(Expression exp) |
Map<ObjAttribute,ColumnDescriptor> |
getAttributeOverrides()
Returns a map of ColumnDescriptors keyed by ObjAttribute for columns that
may need to be reprocessed manually due to incompatible mappings along
the inheritance hierarchy.
|
String |
getCurrentAlias()
Returns an alias of the table which is currently at the top of the join
stack.
|
protected JoinStack |
getJoinStack() |
ColumnDescriptor[] |
getResultColumns()
Returns a list of ColumnDescriptors for the query columns.
|
boolean |
hasJoins() |
boolean |
isSuppressingDistinct()
Returns true if SelectTranslator determined that a query requiring
DISTINCT can't be run with DISTINCT keyword for internal reasons.
|
protected static boolean |
isUnsupportedForDistinct(int type) |
void |
resetJoinStack()
A callback invoked by a child qualifier or ordering processor allowing
query assembler to reset its join stack.
|
boolean |
supportsTableAliases()
Always returns true.
|
addToParamList, ensureTranslated, getAdapter, getBindings, getEntityResolver, getPathAliases, getQuery, getQueryMetadata, getSql, setAddBindingListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBindings, getSql
public DefaultSelectTranslator(Query query, DbAdapter adapter, EntityResolver entityResolver)
protected static boolean isUnsupportedForDistinct(int type)
protected JoinStack getJoinStack()
protected JoinStack createJoinStack()
protected void doTranslate()
doTranslate
in class QueryAssembler
protected String buildDistinctStatement()
protected void appendSelectColumns(StringBuilder buffer, List<String> selectColumnExpList)
protected void appendGroupByColumns(StringBuilder buffer, Map<ColumnDescriptor,List<DbAttributeBinding>> groupByColumns)
protected void appendGroupByColumn(StringBuilder buffer, Map.Entry<ColumnDescriptor,List<DbAttributeBinding>> entry)
protected void appendLimitAndOffsetClauses(StringBuilder buffer)
public String getCurrentAlias()
QueryAssembler
getCurrentAlias
in class QueryAssembler
public ColumnDescriptor[] getResultColumns()
getResultColumns
in interface SelectTranslator
public Map<ObjAttribute,ColumnDescriptor> getAttributeOverrides()
getAttributeOverrides
in interface SelectTranslator
public boolean isSuppressingDistinct()
isSuppressingDistinct
in interface SelectTranslator
protected List<ColumnDescriptor> buildResultColumns()
public void resetJoinStack()
QueryAssembler
resetJoinStack
in class QueryAssembler
public void dbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)
QueryAssembler
dbRelationshipAdded
in class QueryAssembler
public boolean supportsTableAliases()
supportsTableAliases
in class QueryAssembler
public String getAliasForExpression(Expression exp)
getAliasForExpression
in class QueryAssembler
public boolean hasJoins()
hasJoins
in interface SelectTranslator
Copyright © 2001–2019 Apache Cayenne. All rights reserved.