Package org.hibernate.sql.ast.spi
Class AbstractSqlAstTranslator<T extends JdbcOperation>
- java.lang.Object
-
- org.hibernate.sql.ast.spi.AbstractSqlAstTranslator<T>
-
- All Implemented Interfaces:
Appendable
,SqlAppender
,SqlAstTranslator<T>
,SqlAstWalker
- Direct Known Subclasses:
CockroachSqlAstTranslator
,DB2SqlAstTranslator
,DerbySqlAstTranslator
,H2SqlAstTranslator
,HANASqlAstTranslator
,HSQLSqlAstTranslator
,MariaDBSqlAstTranslator
,MySQLSqlAstTranslator
,OracleSqlAstTranslator
,PostgreSQLSqlAstTranslator
,SpannerSqlAstTranslator
,SQLServerSqlAstTranslator
,StandardSqlAstTranslator
,SybaseASESqlAstTranslator
,SybaseSqlAstTranslator
,TiDBSqlAstTranslator
public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> extends Object implements SqlAstTranslator<T>, SqlAppender
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractSqlAstTranslator.ForUpdateClause
protected static class
AbstractSqlAstTranslator.LockStrategy
protected static interface
AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X extends Expression>
-
Field Summary
-
Fields inherited from interface org.hibernate.sql.ast.spi.SqlAppender
CLOSE_PARENTHESIS, COMA_SEPARATOR, COMA_SEPARATOR_CHAR, NO_SEPARATOR, NULL_KEYWORD, OPEN_PARENTHESIS, PARAM_MARKER, WHITESPACE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)
-
Method Summary
-
-
-
Constructor Detail
-
AbstractSqlAstTranslator
protected AbstractSqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)
-
-
Method Detail
-
getDialect
public Dialect getDialect()
-
getSessionFactory
public SessionFactoryImplementor getSessionFactory()
-
castFunction
protected AbstractSqmSelfRenderingFunctionDescriptor castFunction()
-
getWrapperOptions
protected WrapperOptions getWrapperOptions()
-
getSql
public String getSql()
-
cleanup
protected void cleanup()
-
getParameterBinders
public List<JdbcParameterBinder> getParameterBinders()
-
getFilterJdbcParameters
public Set<FilterJdbcParameter> getFilterJdbcParameters()
-
getSqlAppender
protected SqlAppender getSqlAppender()
-
getAffectedTableNames
public Set<String> getAffectedTableNames()
Description copied from interface:SqlAstTranslator
Not the best spot for this. Its the table names collected while walking the SQL AST. Its ok here because the translator is consider a one-time-use. It just needs to be called after translation. A better option is probably to have "translation" objects that expose the affected table-names.- Specified by:
getAffectedTableNames
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
getDmlTargetTableAlias
protected String getDmlTargetTableAlias()
-
getStatement
protected Statement getStatement()
-
getCurrentDmlStatement
public MutationStatement getCurrentDmlStatement()
-
getParameterRenderingMode
protected SqlAstNodeRenderingMode getParameterRenderingMode()
-
addAdditionalWherePredicate
protected void addAdditionalWherePredicate(Predicate predicate)
-
supportsFilterClause
public boolean supportsFilterClause()
Description copied from interface:SqlAstTranslator
Whether the FILTER clause for aggregate functions is supported.- Specified by:
supportsFilterClause
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
appendSql
public void appendSql(String fragment)
Description copied from interface:SqlAppender
Add the passed fragment into the in-flight buffer- Specified by:
appendSql
in interfaceSqlAppender
-
appendSql
public void appendSql(char fragment)
- Specified by:
appendSql
in interfaceSqlAppender
-
appendSql
public void appendSql(int value)
- Specified by:
appendSql
in interfaceSqlAppender
-
appendSql
public void appendSql(long value)
- Specified by:
appendSql
in interfaceSqlAppender
-
appendSql
public void appendSql(boolean value)
- Specified by:
appendSql
in interfaceSqlAppender
-
append
public Appendable append(CharSequence csq)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceSqlAppender
-
append
public Appendable append(CharSequence csq, int start, int end)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceSqlAppender
-
append
public Appendable append(char c)
- Specified by:
append
in interfaceAppendable
- Specified by:
append
in interfaceSqlAppender
-
getJdbcServices
protected JdbcServices getJdbcServices()
-
addAppliedParameterBinding
protected void addAppliedParameterBinding(JdbcParameter parameter, JdbcParameterBinding binding)
-
getAppliedParameterBindings
protected Map<JdbcParameter,JdbcParameterBinding> getAppliedParameterBindings()
-
getJdbcLockStrategy
protected JdbcLockStrategy getJdbcLockStrategy()
-
getJdbcParameterBindings
protected JdbcParameterBindings getJdbcParameterBindings()
-
getLockOptions
protected LockOptions getLockOptions()
-
getLimit
protected Limit getLimit()
-
hasLimit
protected boolean hasLimit()
-
hasOffset
protected boolean hasOffset(QueryPart queryPart)
-
useOffsetFetchClause
protected boolean useOffsetFetchClause(QueryPart queryPart)
-
isRowsOnlyFetchClauseType
protected boolean isRowsOnlyFetchClauseType(QueryPart queryPart)
-
getOffsetParameter
protected JdbcParameter getOffsetParameter()
-
setOffsetParameter
protected void setOffsetParameter(JdbcParameter offsetParameter)
-
getLimitParameter
protected JdbcParameter getLimitParameter()
-
setLimitParameter
protected void setLimitParameter(JdbcParameter limitParameter)
-
interpretExpression
protected <R> R interpretExpression(Expression expression, JdbcParameterBindings jdbcParameterBindings)
-
renderExpressionAsLiteral
protected void renderExpressionAsLiteral(Expression expression, JdbcParameterBindings jdbcParameterBindings)
-
getParameterBindValue
protected Object getParameterBindValue(JdbcParameter parameter)
-
getLeftHandExpression
protected Expression getLeftHandExpression(Predicate predicate)
-
inOverOrWithinGroupClause
protected boolean inOverOrWithinGroupClause()
-
getCurrentQueryPart
public QueryPart getCurrentQueryPart()
Description copied from interface:SqlAstTranslator
Returns the current query part that is translated.- Specified by:
getCurrentQueryPart
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
getCurrentClauseStack
public Stack<Clause> getCurrentClauseStack()
- Specified by:
getCurrentClauseStack
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
translate
public T translate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions)
- Specified by:
translate
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
translateDelete
protected JdbcDelete translateDelete(DeleteStatement sqlAst)
-
translateUpdate
protected JdbcUpdate translateUpdate(UpdateStatement sqlAst)
-
translateInsert
protected JdbcInsert translateInsert(InsertStatement sqlAst)
-
translateSelect
protected JdbcSelect translateSelect(SelectStatement sqlAstSelect)
-
getRowsToSkip
protected int getRowsToSkip(SelectStatement sqlAstSelect, JdbcParameterBindings jdbcParameterBindings)
-
getMaxRows
protected int getMaxRows(SelectStatement sqlAstSelect, JdbcParameterBindings jdbcParameterBindings, int rowsToSkip)
-
needsRowsToSkip
protected boolean needsRowsToSkip()
-
needsMaxRows
protected boolean needsMaxRows()
-
prepareLimitOffsetParameters
protected void prepareLimitOffsetParameters()
-
visitSelectStatement
public void visitSelectStatement(SelectStatement statement)
- Specified by:
visitSelectStatement
in interfaceSqlAstWalker
-
visitDeleteStatement
public void visitDeleteStatement(DeleteStatement statement)
- Specified by:
visitDeleteStatement
in interfaceSqlAstWalker
-
visitUpdateStatement
public void visitUpdateStatement(UpdateStatement statement)
- Specified by:
visitUpdateStatement
in interfaceSqlAstWalker
-
visitAssignment
public void visitAssignment(Assignment assignment)
- Specified by:
visitAssignment
in interfaceSqlAstWalker
-
visitInsertStatement
public void visitInsertStatement(InsertStatement statement)
- Specified by:
visitInsertStatement
in interfaceSqlAstWalker
-
visitDeleteStatementOnly
protected void visitDeleteStatementOnly(DeleteStatement statement)
-
visitUpdateStatementOnly
protected void visitUpdateStatementOnly(UpdateStatement statement)
-
visitInsertStatementOnly
protected void visitInsertStatementOnly(InsertStatement statement)
-
visitForUpdateClause
protected void visitForUpdateClause(QuerySpec querySpec)
-
renderForUpdateClause
protected void renderForUpdateClause(QuerySpec querySpec, AbstractSqlAstTranslator.ForUpdateClause forUpdateClause)
-
getForUpdate
protected String getForUpdate()
-
getForShare
protected String getForShare(int timeoutMillis)
-
getForUpdateWithClause
protected String getForUpdateWithClause()
-
getNoWait
protected String getNoWait()
-
getSkipLocked
protected String getSkipLocked()
-
getEffectiveLockTimeout
protected int getEffectiveLockTimeout(LockMode lockMode)
-
hasAggregateFunctions
protected boolean hasAggregateFunctions(QuerySpec querySpec)
-
determineLockingStrategy
protected AbstractSqlAstTranslator.LockStrategy determineLockingStrategy(QuerySpec querySpec, AbstractSqlAstTranslator.ForUpdateClause forUpdateClause, Boolean followOnLocking)
-
visitReturningColumns
protected void visitReturningColumns(MutationStatement mutationStatement)
-
visitCteContainer
public void visitCteContainer(CteContainer cteContainer)
-
renderMaterializationHint
protected void renderMaterializationHint(CteMaterialization materialization)
-
renderSearchClause
protected void renderSearchClause(CteStatement cte)
-
renderCycleClause
protected void renderCycleClause(CteStatement cte)
-
visitQueryGroup
public void visitQueryGroup(QueryGroup queryGroup)
- Specified by:
visitQueryGroup
in interfaceSqlAstWalker
-
renderQueryGroup
protected void renderQueryGroup(QueryGroup queryGroup, boolean renderOrderByAndOffsetFetchClause)
-
visitQuerySpec
public void visitQuerySpec(QuerySpec querySpec)
- Specified by:
visitQuerySpec
in interfaceSqlAstWalker
-
supportsSimpleQueryGrouping
protected boolean supportsSimpleQueryGrouping()
-
supportsDuplicateSelectItemsInQueryGroup
protected boolean supportsDuplicateSelectItemsInQueryGroup()
-
visitWhereClause
protected final void visitWhereClause(Predicate whereClauseRestrictions)
-
resolveAliasedExpression
protected Expression resolveAliasedExpression(Expression expression)
-
resolveAliasedExpression
protected Expression resolveAliasedExpression(List<SqlSelection> sqlSelections, Expression expression)
-
resolveExpressionToAlias
protected Expression resolveExpressionToAlias(Expression expression)
-
visitGroupByClause
protected final void visitGroupByClause(QuerySpec querySpec, SelectItemReferenceStrategy referenceStrategy)
-
visitPartitionByClause
protected final void visitPartitionByClause(List<Expression> partitionExpressions)
-
visitPartitionExpressions
protected final void visitPartitionExpressions(List<Expression> partitionExpressions, SelectItemReferenceStrategy referenceStrategy)
-
visitPartitionExpressions
protected final void visitPartitionExpressions(List<Expression> partitionExpressions, Function<Expression,Expression> resolveAliasExpression, boolean inlineParametersOfAliasedExpressions)
-
renderPartitionItem
protected void renderPartitionItem(Expression expression)
-
visitHavingClause
protected final void visitHavingClause(QuerySpec querySpec)
-
visitOrderBy
protected void visitOrderBy(List<SortSpecification> sortSpecifications)
-
renderOrderBy
protected void renderOrderBy(boolean addWhitespace, List<SortSpecification> sortSpecifications)
-
emulateSelectTupleComparison
protected void emulateSelectTupleComparison(List<SqlSelection> lhsSelections, List<? extends SqlAstNode> rhsExpressions, ComparisonOperator operator, boolean indexOptimized)
-
emulateTupleComparison
protected void emulateTupleComparison(List<? extends SqlAstNode> lhsExpressions, List<? extends SqlAstNode> rhsExpressions, ComparisonOperator operator, boolean indexOptimized)
A tuple comparison like(a, b) > (1, 2)
can be emulated through it logical definition:a > 1 or a = 1 and b > 2
. The normal tuple comparison emulation is not very index friendly though because of the top level OR predicate. Index optimized emulation of tuple comparisons puts an AND predicate on the top level. The effect of that is, that the database can do an index seek to efficiently find a superset of matching rows. Generally, it is sufficient to just add a broader predicate like for(a, b) > (1, 2)
we adda >= 1 and (..)
. But we can further optimize this if we just remove the non-matching parts from this too broad predicate. For(a, b, c) > (1, 2, 3)
we use the broad predicatea >= 1
and then want to remove rows wherea = 1 and (b, c) <= (2, 3)
-
supportsIntersect
protected boolean supportsIntersect()
-
supportsNestedSubqueryCorrelation
protected boolean supportsNestedSubqueryCorrelation()
-
renderExpressionsAsSubquery
protected void renderExpressionsAsSubquery(List<? extends Expression> expressions)
-
renderSelectSimpleComparison
protected void renderSelectSimpleComparison(List<SqlSelection> lhsExpressions, Expression expression, ComparisonOperator operator)
-
renderSelectTupleComparison
protected void renderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
-
renderTupleComparisonStandard
protected void renderTupleComparisonStandard(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
-
renderComparison
protected void renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs)
-
renderComparisonStandard
protected void renderComparisonStandard(Expression lhs, ComparisonOperator operator, Expression rhs)
-
renderComparisonDistinctOperator
protected void renderComparisonDistinctOperator(Expression lhs, ComparisonOperator operator, Expression rhs)
-
renderComparisonEmulateDecode
protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs)
-
renderComparisonEmulateCase
protected void renderComparisonEmulateCase(Expression lhs, ComparisonOperator operator, Expression rhs)
-
renderComparisonEmulateIntersect
protected void renderComparisonEmulateIntersect(Expression lhs, ComparisonOperator operator, Expression rhs)
-
visitSortSpecification
public void visitSortSpecification(SortSpecification sortSpecification)
- Specified by:
visitSortSpecification
in interfaceSqlAstWalker
-
visitSortSpecification
protected void visitSortSpecification(Expression sortExpression, SortOrder sortOrder, NullPrecedence nullPrecedence)
-
supportsNullPrecedence
protected boolean supportsNullPrecedence()
-
emulateSortSpecificationNullPrecedence
protected void emulateSortSpecificationNullPrecedence(Expression sortExpression, NullPrecedence nullPrecedence)
-
visitOffsetFetchClause
public void visitOffsetFetchClause(QueryPart queryPart)
- Specified by:
visitOffsetFetchClause
in interfaceSqlAstWalker
-
renderOffsetFetchClause
protected void renderOffsetFetchClause(QueryPart queryPart, boolean renderOffsetRowsKeyword)
-
renderOffsetFetchClause
protected void renderOffsetFetchClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean renderOffsetRowsKeyword)
-
renderOffset
protected void renderOffset(Expression offsetExpression, boolean renderOffsetRowsKeyword)
-
renderFetch
protected void renderFetch(Expression fetchExpression, Expression offsetExpressionToAdd, FetchClauseType fetchClauseType)
-
renderOffsetExpression
protected void renderOffsetExpression(Expression offsetExpression)
-
renderFetchExpression
protected void renderFetchExpression(Expression fetchExpression)
-
renderTopClause
protected void renderTopClause(QuerySpec querySpec, boolean addOffset, boolean needsParenthesis)
-
renderTopClause
protected void renderTopClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean addOffset, boolean needsParenthesis)
-
renderTopStartAtClause
protected void renderTopStartAtClause(QuerySpec querySpec)
-
renderTopStartAtClause
protected void renderTopStartAtClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType)
-
renderRowsToClause
protected void renderRowsToClause(QuerySpec querySpec)
-
renderRowsToClause
protected void renderRowsToClause(Expression offsetClauseExpression, Expression fetchClauseExpression)
-
renderFetchPlusOffsetExpression
protected void renderFetchPlusOffsetExpression(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
-
renderFetchPlusOffsetExpressionAsLiteral
protected void renderFetchPlusOffsetExpressionAsLiteral(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
-
renderFetchPlusOffsetExpressionAsSingleParameter
protected void renderFetchPlusOffsetExpressionAsSingleParameter(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
-
renderFirstSkipClause
protected void renderFirstSkipClause(QuerySpec querySpec)
-
renderFirstSkipClause
protected void renderFirstSkipClause(Expression offsetExpression, Expression fetchExpression)
-
renderSkipFirstClause
protected void renderSkipFirstClause(QuerySpec querySpec)
-
renderSkipFirstClause
protected void renderSkipFirstClause(Expression offsetExpression, Expression fetchExpression)
-
renderFirstClause
protected void renderFirstClause(QuerySpec querySpec)
-
renderFirstClause
protected void renderFirstClause(Expression offsetExpression, Expression fetchExpression)
-
renderCombinedLimitClause
protected void renderCombinedLimitClause(QueryPart queryPart)
-
renderCombinedLimitClause
protected void renderCombinedLimitClause(Expression offsetExpression, Expression fetchExpression)
-
renderLimitOffsetClause
protected void renderLimitOffsetClause(QueryPart queryPart)
-
renderLimitOffsetClause
protected void renderLimitOffsetClause(Expression offsetExpression, Expression fetchExpression)
-
assertRowsOnlyFetchClauseType
protected void assertRowsOnlyFetchClauseType(QueryPart queryPart)
-
getQueryPartForRowNumbering
protected QueryPart getQueryPartForRowNumbering()
-
isRowNumberingCurrentQueryPart
protected boolean isRowNumberingCurrentQueryPart()
-
emulateFetchOffsetWithWindowFunctions
protected void emulateFetchOffsetWithWindowFunctions(QueryPart queryPart, boolean emulateFetchClause)
-
emulateFetchOffsetWithWindowFunctions
protected void emulateFetchOffsetWithWindowFunctions(QueryPart queryPart, Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean emulateFetchClause)
-
withRowNumbering
protected final void withRowNumbering(QueryPart queryPart, boolean needsSelectAliases, Runnable r)
-
visitSelectClause
public void visitSelectClause(SelectClause selectClause)
- Specified by:
visitSelectClause
in interfaceSqlAstWalker
-
visitSqlSelections
protected void visitSqlSelections(SelectClause selectClause)
-
getSelectItemReference
protected final SqlSelectionExpression getSelectItemReference(Expression expression)
-
renderRowNumberingSelectItems
protected void renderRowNumberingSelectItems(SelectClause selectClause, QueryPart queryPart)
-
getFetchClauseTypeForRowNumbering
protected FetchClauseType getFetchClauseTypeForRowNumbering(QueryPart queryPartForRowNumbering)
-
visitOver
public void visitOver(Over<?> over)
- Specified by:
visitOver
in interfaceSqlAstWalker
-
visitOverClause
protected final void visitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications)
-
visitOverClause
protected void visitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications, FrameMode mode, FrameKind startKind, Expression startExpression, FrameKind endKind, Expression endExpression, FrameExclusion exclusion, boolean orderedSetAggregate)
-
renderRowNumber
protected void renderRowNumber(SelectClause selectClause, QueryPart queryPart)
-
isParameter
protected final boolean isParameter(Expression expression)
-
isLiteral
protected final boolean isLiteral(Expression expression)
-
getSortSpecificationsRowNumbering
protected List<SortSpecification> getSortSpecificationsRowNumbering(SelectClause selectClause, QueryPart queryPart)
-
visitSqlSelection
public void visitSqlSelection(SqlSelection sqlSelection)
- Specified by:
visitSqlSelection
in interfaceSqlAstWalker
-
visitSqlSelectExpression
protected void visitSqlSelectExpression(Expression expression)
-
visitSqlSelectExpression
protected int visitSqlSelectExpression(Expression expression, int offset, List<String> columnAliases)
-
renderSelectExpression
protected void renderSelectExpression(Expression expression)
-
renderExpressionAsClauseItem
protected void renderExpressionAsClauseItem(Expression expression)
-
renderSelectExpressionWithCastedOrInlinedPlainParameters
protected void renderSelectExpressionWithCastedOrInlinedPlainParameters(Expression expression)
-
renderCasted
protected void renderCasted(Expression expression)
-
renderLiteral
protected void renderLiteral(Literal literal, boolean castParameter)
-
visitFromClause
public void visitFromClause(FromClause fromClause)
- Specified by:
visitFromClause
in interfaceSqlAstWalker
-
renderRootTableGroup
protected void renderRootTableGroup(TableGroup tableGroup, List<TableGroupJoin> tableGroupJoinCollector)
-
renderTableGroup
protected void renderTableGroup(TableGroup tableGroup, Predicate predicate, List<TableGroupJoin> tableGroupJoinCollector)
-
hasNestedTableGroupsToRender
protected boolean hasNestedTableGroupsToRender(List<TableGroupJoin> nestedTableGroupJoins)
-
renderPrimaryTableReference
protected boolean renderPrimaryTableReference(TableGroup tableGroup, LockMode lockMode)
-
renderNamedTableReference
protected boolean renderNamedTableReference(NamedTableReference tableReference, LockMode lockMode)
-
visitValuesTableReference
public void visitValuesTableReference(ValuesTableReference tableReference)
- Specified by:
visitValuesTableReference
in interfaceSqlAstWalker
-
visitQueryPartTableReference
public void visitQueryPartTableReference(QueryPartTableReference tableReference)
- Specified by:
visitQueryPartTableReference
in interfaceSqlAstWalker
-
visitFunctionTableReference
public void visitFunctionTableReference(FunctionTableReference tableReference)
- Specified by:
visitFunctionTableReference
in interfaceSqlAstWalker
-
emulateQueryPartTableReferenceColumnAliasing
protected void emulateQueryPartTableReferenceColumnAliasing(QueryPartTableReference tableReference)
-
emulateValuesTableReferenceColumnAliasing
protected void emulateValuesTableReferenceColumnAliasing(ValuesTableReference tableReference)
-
renderDerivedTableReference
protected void renderDerivedTableReference(DerivedTableReference tableReference)
-
renderTableReferenceIdentificationVariable
protected final void renderTableReferenceIdentificationVariable(TableReference tableReference)
-
rendersTableReferenceAlias
public static boolean rendersTableReferenceAlias(Clause clause)
-
registerAffectedTable
protected void registerAffectedTable(NamedTableReference tableReference)
-
registerAffectedTable
protected void registerAffectedTable(String tableExpression)
-
renderTableReferenceJoins
protected void renderTableReferenceJoins(TableGroup tableGroup)
-
processTableGroupJoins
protected void processTableGroupJoins(TableGroup source)
-
processNestedTableGroupJoins
protected void processNestedTableGroupJoins(TableGroup source, List<TableGroupJoin> tableGroupJoinCollector)
-
processTableGroupJoin
protected void processTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGroupJoin> tableGroupJoinCollector)
-
renderTableGroupJoin
protected void renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGroupJoin> tableGroupJoinCollector)
-
determineLateralEmulationPredicate
protected Predicate determineLateralEmulationPredicate(TableGroup tableGroup)
-
visitTableGroup
public void visitTableGroup(TableGroup tableGroup)
- Specified by:
visitTableGroup
in interfaceSqlAstWalker
-
visitTableGroupJoin
public void visitTableGroupJoin(TableGroupJoin tableGroupJoin)
- Specified by:
visitTableGroupJoin
in interfaceSqlAstWalker
-
visitNamedTableReference
public void visitNamedTableReference(NamedTableReference tableReference)
- Specified by:
visitNamedTableReference
in interfaceSqlAstWalker
-
visitTableReferenceJoin
public void visitTableReferenceJoin(TableReferenceJoin tableReferenceJoin)
- Specified by:
visitTableReferenceJoin
in interfaceSqlAstWalker
-
visitColumnReference
public void visitColumnReference(ColumnReference columnReference)
- Specified by:
visitColumnReference
in interfaceSqlAstWalker
-
visitExtractUnit
public void visitExtractUnit(ExtractUnit extractUnit)
- Specified by:
visitExtractUnit
in interfaceSqlAstWalker
-
visitDurationUnit
public void visitDurationUnit(DurationUnit unit)
- Specified by:
visitDurationUnit
in interfaceSqlAstWalker
-
visitFormat
public void visitFormat(Format format)
- Specified by:
visitFormat
in interfaceSqlAstWalker
-
visitStar
public void visitStar(Star star)
- Specified by:
visitStar
in interfaceSqlAstWalker
-
visitTrimSpecification
public void visitTrimSpecification(TrimSpecification trimSpecification)
- Specified by:
visitTrimSpecification
in interfaceSqlAstWalker
-
visitCastTarget
public void visitCastTarget(CastTarget castTarget)
- Specified by:
visitCastTarget
in interfaceSqlAstWalker
-
visitDistinct
public void visitDistinct(Distinct distinct)
- Specified by:
visitDistinct
in interfaceSqlAstWalker
-
visitOverflow
public void visitOverflow(Overflow overflow)
- Specified by:
visitOverflow
in interfaceSqlAstWalker
-
visitParameter
public void visitParameter(JdbcParameter jdbcParameter)
- Specified by:
visitParameter
in interfaceSqlAstWalker
-
render
public void render(SqlAstNode sqlAstNode, SqlAstNodeRenderingMode renderingMode)
Description copied from interface:SqlAstTranslator
Renders the given SQL AST node with the given rendering mode.- Specified by:
render
in interfaceSqlAstTranslator<T extends JdbcOperation>
-
visitTuple
public void visitTuple(SqlTuple tuple)
- Specified by:
visitTuple
in interfaceSqlAstWalker
-
renderCommaSeparated
protected final void renderCommaSeparated(Iterable<? extends SqlAstNode> expressions)
-
renderCommaSeparatedSelectExpression
protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions)
-
renderCommaSeparatedSelectExpression
protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions, Iterable<String> aliases)
-
visitCollation
public void visitCollation(Collation collation)
- Specified by:
visitCollation
in interfaceSqlAstWalker
-
visitSqlSelectionExpression
public void visitSqlSelectionExpression(SqlSelectionExpression expression)
- Specified by:
visitSqlSelectionExpression
in interfaceSqlAstWalker
-
visitEntityTypeLiteral
public void visitEntityTypeLiteral(EntityTypeLiteral expression)
- Specified by:
visitEntityTypeLiteral
in interfaceSqlAstWalker
-
visitBinaryArithmeticExpression
public void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
- Specified by:
visitBinaryArithmeticExpression
in interfaceSqlAstWalker
-
visitDuration
public void visitDuration(Duration duration)
- Specified by:
visitDuration
in interfaceSqlAstWalker
-
visitConversion
public void visitConversion(Conversion conversion)
- Specified by:
visitConversion
in interfaceSqlAstWalker
-
visitCaseSearchedExpression
public final void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression)
- Specified by:
visitCaseSearchedExpression
in interfaceSqlAstWalker
-
visitCaseSearchedExpression
protected void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, boolean inSelect)
-
visitAnsiCaseSearchedExpression
protected void visitAnsiCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, Consumer<Expression> resultRenderer)
-
visitDecodeCaseSearchedExpression
protected void visitDecodeCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression)
-
visitCaseSimpleExpression
public final void visitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression)
- Specified by:
visitCaseSimpleExpression
in interfaceSqlAstWalker
-
visitCaseSimpleExpression
protected void visitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, boolean inSelect)
-
visitAnsiCaseSimpleExpression
protected void visitAnsiCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, Consumer<Expression> resultRenderer)
-
areAllResultsParameters
protected boolean areAllResultsParameters(CaseSearchedExpression caseSearchedExpression)
-
areAllResultsParameters
protected boolean areAllResultsParameters(CaseSimpleExpression caseSimpleExpression)
-
visitAny
public void visitAny(Any any)
- Specified by:
visitAny
in interfaceSqlAstWalker
-
visitEvery
public void visitEvery(Every every)
- Specified by:
visitEvery
in interfaceSqlAstWalker
-
visitSummarization
public void visitSummarization(Summarization every)
- Specified by:
visitSummarization
in interfaceSqlAstWalker
-
visitJdbcLiteral
public void visitJdbcLiteral(JdbcLiteral<?> jdbcLiteral)
- Specified by:
visitJdbcLiteral
in interfaceSqlAstWalker
-
visitQueryLiteral
public void visitQueryLiteral(QueryLiteral<?> queryLiteral)
- Specified by:
visitQueryLiteral
in interfaceSqlAstWalker
-
renderAsLiteral
protected void renderAsLiteral(JdbcParameter jdbcParameter, Object literalValue)
-
visitUnaryOperationExpression
public void visitUnaryOperationExpression(UnaryOperation unaryOperationExpression)
- Specified by:
visitUnaryOperationExpression
in interfaceSqlAstWalker
-
visitModifiedSubQueryExpression
public void visitModifiedSubQueryExpression(ModifiedSubQueryExpression expression)
- Specified by:
visitModifiedSubQueryExpression
in interfaceSqlAstWalker
-
visitSelfRenderingPredicate
public void visitSelfRenderingPredicate(SelfRenderingPredicate selfRenderingPredicate)
- Specified by:
visitSelfRenderingPredicate
in interfaceSqlAstWalker
-
visitSelfRenderingExpression
public void visitSelfRenderingExpression(SelfRenderingExpression expression)
- Specified by:
visitSelfRenderingExpression
in interfaceSqlAstWalker
-
visitBooleanExpressionPredicate
public void visitBooleanExpressionPredicate(BooleanExpressionPredicate booleanExpressionPredicate)
- Specified by:
visitBooleanExpressionPredicate
in interfaceSqlAstWalker
-
visitBetweenPredicate
public void visitBetweenPredicate(BetweenPredicate betweenPredicate)
- Specified by:
visitBetweenPredicate
in interfaceSqlAstWalker
-
visitFilterPredicate
public void visitFilterPredicate(FilterPredicate filterPredicate)
- Specified by:
visitFilterPredicate
in interfaceSqlAstWalker
-
visitFilterFragmentPredicate
public void visitFilterFragmentPredicate(FilterPredicate.FilterFragmentPredicate fragmentPredicate)
- Specified by:
visitFilterFragmentPredicate
in interfaceSqlAstWalker
-
visitSqlFragmentPredicate
public void visitSqlFragmentPredicate(SqlFragmentPredicate predicate)
- Specified by:
visitSqlFragmentPredicate
in interfaceSqlAstWalker
-
visitGroupedPredicate
public void visitGroupedPredicate(GroupedPredicate groupedPredicate)
- Specified by:
visitGroupedPredicate
in interfaceSqlAstWalker
-
visitInListPredicate
public void visitInListPredicate(InListPredicate inListPredicate)
- Specified by:
visitInListPredicate
in interfaceSqlAstWalker
-
visitInSubQueryPredicate
public void visitInSubQueryPredicate(InSubQueryPredicate inSubQueryPredicate)
- Specified by:
visitInSubQueryPredicate
in interfaceSqlAstWalker
-
emulateSubQueryRelationalRestrictionPredicate
protected <X extends Expression> void emulateSubQueryRelationalRestrictionPredicate(Predicate predicate, boolean negated, QueryPart queryPart, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator)
-
emulateQuantifiedTupleSubQueryPredicate
protected void emulateQuantifiedTupleSubQueryPredicate(Predicate predicate, QueryPart queryPart, SqlTuple lhsTuple, ComparisonOperator tupleComparisonOperator)
An optimized emulation for relational tuple sub-query comparisons. The idea of this method is to use limit 1 to select the max or min tuple and only compare against that.
-
visitExistsPredicate
public void visitExistsPredicate(ExistsPredicate existsPredicate)
- Specified by:
visitExistsPredicate
in interfaceSqlAstWalker
-
visitJunction
public void visitJunction(Junction junction)
- Specified by:
visitJunction
in interfaceSqlAstWalker
-
visitLikePredicate
public void visitLikePredicate(LikePredicate likePredicate)
- Specified by:
visitLikePredicate
in interfaceSqlAstWalker
-
renderCaseInsensitiveLikeEmulation
protected void renderCaseInsensitiveLikeEmulation(Expression lhs, Expression rhs, Expression escapeCharacter, boolean negated)
-
renderBackslashEscapedLikePattern
protected void renderBackslashEscapedLikePattern(Expression pattern, Expression escapeCharacter, boolean noBackslashEscapes)
-
appendBackslashEscapedLikeLiteral
protected void appendBackslashEscapedLikeLiteral(SqlAppender appender, String literal, boolean noBackslashEscapes)
-
visitNegatedPredicate
public void visitNegatedPredicate(NegatedPredicate negatedPredicate)
- Specified by:
visitNegatedPredicate
in interfaceSqlAstWalker
-
visitNullnessPredicate
public void visitNullnessPredicate(NullnessPredicate nullnessPredicate)
- Specified by:
visitNullnessPredicate
in interfaceSqlAstWalker
-
visitRelationalPredicate
public void visitRelationalPredicate(ComparisonPredicate comparisonPredicate)
- Specified by:
visitRelationalPredicate
in interfaceSqlAstWalker
-
supportsQuantifiedPredicates
protected boolean supportsQuantifiedPredicates()
Is this dialect known to support quantified predicates. Basically, does it support syntax like "... where FIRST_NAME > ALL (select ...) ...".- Returns:
- True if this SQL dialect is known to support quantified predicates; false otherwise.
-
supportsDistinctFromPredicate
protected boolean supportsDistinctFromPredicate()
Is this SQL dialect known to support some kind of distinct from predicate. Basically, does it support syntax like "... where FIRST_NAME IS DISTINCT FROM LAST_NAME"- Returns:
- True if this SQL dialect is known to support some kind of distinct from predicate; false otherwise
-
supportsRowValueConstructorSyntax
protected boolean supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax. Basically, does it support syntax like "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax; false otherwise.
-
supportsRowValueConstructorGtLtSyntax
protected boolean supportsRowValueConstructorGtLtSyntax()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with<
,>
,≤
and≥
operators. Basically, does it support syntax like "... where (FIRST_NAME, LAST_NAME) < ('Steve', 'Ebersole') ...".- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax with relational comparison operators; false otherwise.
-
supportsRowValueConstructorSyntaxInSet
protected boolean supportsRowValueConstructorSyntaxInSet()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax, sometimes called tuple syntax, in the SET clause; Basically, does it support syntax like "... SET (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax in the SET clause; false otherwise.
-
supportsRowValueConstructorSyntaxInQuantifiedPredicates
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates. Basically, does it support syntax like "... where (FIRST_NAME, LAST_NAME) = ALL (select ...) ...".- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax with quantified predicates; false otherwise.
-
supportsRowValueConstructorSyntaxInInList
protected boolean supportsRowValueConstructorSyntaxInInList()
If the dialect supportsrow values
, does it offer such support in IN lists as well? For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax in the IN list; false otherwise.
-
supportsRowValueConstructorSyntaxInInSubQuery
protected boolean supportsRowValueConstructorSyntaxInInSubQuery()
If the dialect supportsrow values
, does it offer such support in IN subqueries as well? For example, "... where (FIRST_NAME, LAST_NAME) IN ( select ... ) ..."- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax in the IN subqueries; false otherwise.
-
getFromDual
protected String getFromDual()
Some databases require a bit of syntactic noise when there are no tables in the from clause.- Returns:
- the SQL equivalent to Oracle's
from dual
.
-
getFromDualForSelectOnly
protected String getFromDualForSelectOnly()
-
-