Class AbstractSqlAstTranslator<T extends JdbcOperation>
- All Implemented Interfaces:
Appendable, SqlAstWalker, SqlAstTranslator<T>, SqlAppender
- Direct Known Subclasses:
SqlAstTranslatorWithMerge, SqlAstTranslatorWithOnDuplicateKeyUpdate, SqlAstTranslatorWithUpsert, StandardSqlAstTranslator
Supported generic base for translating query and model-mutation SQL ASTs.
This class owns the single-use translation lifecycle, SQL buffer, parameter
bindings, traversal stacks, and other mutable rendering context. A custom
Dialect which renders SQL should extend this class, or a supported
database-family subclass. A JDBC driver with a fundamentally different
command language may instead implement
SqlAstTranslator directly, normally
on top of AbstractSqlAstWalker.
Prefer the focused get...Support() composition hooks when a difference can
be expressed as selection of an immutable rendering plan. Override a
protected rendering callback only when the database grammar cannot be
represented by an existing support strategy. In either case, preserve the
base class's stack and clause-management lifecycle; methods documented as
owning that lifecycle should be entered through their visit... form.
Each instance translates exactly the SqlAstTranslationRequest supplied to
its constructor and must not be cached or reused.
- Since:
- 8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumprotected static interface -
Field Summary
Fields inherited from interface SqlAppender
CLOSE_PARENTHESIS, COMMA_SEPARATOR, COMMA_SEPARATOR_CHAR, NO_SEPARATOR, NULL_KEYWORD, OPEN_PARENTHESIS, PARAM_MARKER, WHITESPACE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSqlAstTranslator(SqlAstTranslationRequest<? extends Statement, T> request) Creates a translator for one complete, typed translation request. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddAdditionalWherePredicate(Predicate predicate) final voidaddAffectedTableName(String tableName) Register an affected physical table name while translating a mutation.protected final intaddParameterBinder(JdbcParameter parameter) protected final intaddParameterBinder(JdbcParameter parameter, JdbcParameterBinder parameterBinder) protected voidafterQueryGroup(QueryGroup queryGroup, QueryPart currentQueryPart) append(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) protected voidappendBackslashEscapedLikeLiteral(SqlAppender appender, String literal, boolean noBackslashEscapes) voidvoidvoidappendSql(boolean value) voidappendSql(char fragment) voidappendSql(double value) voidappendSql(float value) voidappendSql(int value) voidappendSql(long value) voidAdd the passed fragment into the in-flight bufferprotected voidapplySqlComment(String comment) protected booleanareAllResultsParameters(CaseSearchedExpression caseSearchedExpression) protected booleanareAllResultsParameters(CaseSimpleExpression caseSimpleExpression) protected voidassertRowsOnlyFetchClauseType(QueryPart queryPart) protected voidbeforeQueryGroup(QueryGroup queryGroup, QueryPart currentQueryPart) protected final FunctionRendererprotected ExpressioncastNumberToString(Expression expression, int precision, int scale) Casts a number expression to a string with the given precision and scale.protected StringdetermineColumnReferenceQualifier(ColumnReference columnReference) protected Stringprotected PredicatedetermineLateralEmulationPredicate(TableGroup tableGroup) protected AbstractSqlAstTranslator.LockStrategydetermineLockingStrategy(QuerySpec querySpec, Locking.FollowOn followOnStrategy) protected final PaginationRenderingPlandeterminePaginationRenderingPlan(QueryPart queryPart) protected Stringprotected voidemulateCycleClauseWithRowAndArray(SelectClause selectClause) protected voidemulateFetchOffsetWithWindowFunctions(QueryPart queryPart, boolean emulateFetchClause) protected voidemulateFetchOffsetWithWindowFunctions(QueryPart queryPart, Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean emulateFetchClause) protected voidprotected voidemulateQuantifiedTupleSubQueryPredicate(Predicate predicate, SelectStatement selectStatement, SqlTuple lhsTuple, ComparisonOperator tupleComparisonOperator) An optimized emulation for relational tuple sub-query comparisons.protected voidemulateSearchClauseOrderWithRowAndArray(SelectClause selectClause) protected voidemulateSelectTupleComparison(List<SqlSelection> lhsSelections, List<? extends SqlAstNode> rhsExpressions, ComparisonOperator operator, boolean indexOptimized) protected voidemulateSortSpecificationNullPrecedence(Expression sortExpression, Nulls nullPrecedence) protected <X extends Expression>
voidemulateSubQueryRelationalRestrictionPredicate(Predicate predicate, boolean negated, SelectStatement selectStatement, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator) protected voidemulateTupleComparison(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.Not the best spot for this.protected StringReturns the name of thearray_contains(array, element)function, which is used for emulating the cycle clause.protected SqlAstNodeRenderingModeThe parameter rendering mode to use while rendering a CTE container.protected final CteStatementgetCteStatement(String cteName) Read-only access to the translator's current clause stack.protected final MutationStatementfinal QueryPartThe query part at the top of the translator's traversal stack.protected DerivedTableRenderingSupportSupplies the strategy which selects derived-table rendering plans.protected Dialectprotected LockModeprotected LockModegetEffectiveLockMode(String alias) protected LockModegetEffectiveLockMode(String alias, boolean isRoot) protected intgetEffectiveLockTimeout(LockMode lockMode) protected FetchClauseTypegetFetchClauseTypeForRowNumbering(QueryPart queryPartForRowNumbering) protected SelectItemReferenceStrategySelect how this translator refers to select items in agroup byclause.protected InsertConflictRenderingSupportSupplies the strategy which selects insert-conflict rendering plans.protected final JdbcParameterBindingsprotected final JdbcServicesprotected ExpressiongetLeftHandExpression(Predicate predicate) protected final LimitgetLimit()protected final JdbcParameterfinal <X> XgetLiteralValue(Expression expression) Returns the literal value of the given expression, inlining a parameter value if necessary.protected LockingClauseStrategyprotected final LockOptionsprotected final JdbcParameterprotected PaginationRenderingSupportSupplies the strategy which selects SQL AST pagination plans.protected final List<JdbcParameterBinder> protected ObjectgetParameterBindValue(JdbcParameter parameter) protected SqlAstNodeRenderingModeprotected QueryMutationRenderingSupportSupplies the strategy which selects query update and delete rendering plans.protected QueryPartprotected ReturningRenderingSupportSupplies the strategy which selects how mutations return generated column values.protected final SqlSelectionExpressiongetSelectItemReference(Expression expression) protected StringThe complete optionalfromfragment for an otherwise table-less select.The SessionFactory whose services are used during translation.protected SetReturningFunctionRenderingSupportSupplies the strategy which selects named set-returning-function plans.protected StringThe reusable single-row table expression supplied by the Dialect.protected List<SortSpecification> getSortSpecificationsRowNumbering(SelectClause selectClause, QueryPart queryPart) protected final StringgetSql()final StatementThe SQL AST assigned to this translator.protected final Statementprotected TableJoinRenderingSupportSupplies the strategy which selects table-join rendering plans.protected final SqlAstTranslationRequest<? extends Statement, T> protected final EntityVersionMappinggetVersionSeedMapping(Expression expression) Returns the version mapping when the expression is Hibernate's generated optimistic-lock version-seed parameter.protected final WrapperOptionsprotected booleanhasAggregateFunctions(QuerySpec querySpec) protected final booleanhasFrom(FromClause fromClause) protected final booleanhasLimit()protected final booleanprotected final booleanprotected static booleanhasNonTrivialFromClause(FromClause fromClause) protected final booleanprotected final booleanhasTargetTableCorrelation(MutationStatement statement) protected booleanprotected booleanprotected <R> RinterpretExpression(Expression expression, JdbcParameterBindings jdbcParameterBindings) protected booleanprotected booleanprotected booleanprotected final booleanisLiteral(Expression expression) protected static booleanisLob(JdbcMappingContainer expressionType) static booleanisParameter(Expression expression) protected final booleanisParameterInterpretation(Expression expression) Whether the expression represents Hibernate's interpretation of an SQM parameter.protected final booleanprotected final booleanprotected final booleanprotected booleanprotected final booleanisRowsOnlyFetchClauseType(QueryPart queryPart) protected booleanisStruct(JdbcMappingContainer expressionType) protected booleanWhether CTEs should be inlined rather than rendered as CTEs.protected final booleanneedsLocking(QuerySpec querySpec) protected booleanprotected voidregisterAffectedTable(String tableExpression) protected voidregisterAffectedTable(NamedTableReference tableReference) final voidrender(SqlAstNode sqlAstNode, SqlAstNodeRenderingMode renderingMode) Render the given SQL AST node using the requested expression mode and the current translator context.protected voidrenderAsLiteral(JdbcParameter jdbcParameter, Object literalValue) protected voidprotected voidrenderBackslashEscapedLikePattern(Expression pattern, Expression escapeCharacter, boolean noBackslashEscapes) protected voidrenderCaseInsensitiveLikeEmulation(Expression lhs, Expression rhs, Expression escapeCharacter, boolean negated) protected voidrenderCasted(Expression expression) protected voidrenderColumnWrite(ColumnValueBinding selectionBinding) protected voidrenderCombinedLimitClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderCombinedLimitClause(QueryPart queryPart) protected final voidrenderCommaSeparated(Iterable<? extends SqlAstNode> expressions) protected final voidrenderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions) protected final voidrenderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions, Iterable<String> aliases) protected voidrenderComparison(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidrenderComparisonDistinctOperator(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidrenderComparisonEmulateCase(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidrenderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidrenderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs, SqlAstNodeRenderingMode firstArgRenderingMode) protected voidrenderComparisonEmulateIntersect(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidrenderComparisonStandard(Expression lhs, ComparisonOperator operator, Expression rhs) protected voidRender a hint immediately after the firstselectkeyword of the given CTE definition.protected voidprotected voidRender the optional path column of a standard CTE cycle clause.protected voidrenderDeleteClause(DeleteStatement statement) protected final voidrenderDeleteStatementDirect(DeleteStatement statement) protected final voidrenderDeleteStatementWithJoinEmulation(DeleteStatement statement, String targetAlias) protected final voidprotected voidrenderDmlTargetTableExpression(NamedTableReference tableReference) protected voidRender the ordering required by a window with no sort specifications.protected voidrenderEscapeCharacter(Expression escapeCharacter) protected voidrenderExpressionAsClauseItem(Expression expression) protected voidrenderExpressionAsLiteral(Expression expression, JdbcParameterBindings jdbcParameterBindings) protected voidrenderExpressionsAsSubquery(List<? extends Expression> expressions) protected voidrenderExpressionsAsValuesSubquery(int tupleSize, List<Expression> listExpressions) protected voidrenderFetch(Expression fetchExpression, Expression offsetExpressionToAdd, FetchClauseType fetchClauseType) protected voidrenderFetchExpression(Expression fetchExpression) protected voidprotected voidrenderFetchPlusOffsetExpression(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset) protected voidrenderFetchPlusOffsetExpressionAsLiteral(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset) protected voidrenderFetchPlusOffsetExpressionAsSingleParameter(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset) protected voidrenderFirstClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderFirstClause(QuerySpec querySpec) protected voidrenderFirstSkipClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderFirstSkipClause(QuerySpec querySpec) protected voidrenderFromClauseAfterUpdateSet(UpdateStatement statement) protected voidprotected voidprotected final voidrenderFromClauseSpaces(FromClause fromClause) protected voidrenderInsertInto(TableInsertStandard tableInsert) protected voidrenderInsertIntoNoColumns(TableInsertStandard tableInsert) Render a completeinsert intostatement for an insert with no column value bindings.protected final voidprotected voidrenderInterval(Duration duration) protected voidrenderIntervalLiteral(Literal literal, TemporalUnit unit) protected voidrenderIntoIntoAndTable(TableInsertStandard tableInsert) Renders theinsert into <table name>portion of an insertprotected booleanrenderLegacyReturningInsert(TableInsertStandard tableInsert) Temporary escape hatch for the legacy H2 identity-returning path, which renders an additional statement and cannot be expressed as a single returning plan.protected voidrenderLikePattern(Expression pattern, Expression escapeCharacter) protected voidrenderLikePredicate(LikePredicate likePredicate) protected voidrenderLimitOffsetClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderLimitOffsetClause(QueryPart queryPart) protected voidrenderLiteral(Literal literal, boolean castParameter) protected voidrenderMaterializationHint(CteMaterialization materialization) protected voidrenderMergeUpdateClause(List<Assignment> assignments, Predicate wherePredicate) final voidrenderNamedSetReturningFunction(String functionName, List<? extends SqlAstNode> sqlAstArguments, SetReturningFunctionType tupleType, String tableIdentifierVariable, SqlAstNodeRenderingMode argumentRenderingMode) Renders a named set returning function.protected voidrenderNull(Literal literal) protected voidrenderOffset(Expression offsetExpression, boolean renderOffsetRowsKeyword) protected voidrenderOffsetExpression(Expression offsetExpression) protected voidrenderOffsetFetchClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean renderOffsetRowsKeyword) protected voidrenderOffsetFetchClause(QueryPart queryPart, boolean renderOffsetRowsKeyword) protected final voidrenderOnDuplicateKeyConflictClause(InsertSelectStatement statement, ConflictClause conflictClause, InsertConflictRenderingPlan.OnDuplicateKey plan) protected final voidrenderOrderByClause(List<SortSpecification> sortSpecifications) Render a standard order-by clause, including its leading whitespace.protected voidrenderParameterAsParameter(int position, JdbcParameter jdbcParameter) Renders a parameter marker for the given positionprotected voidrenderPartitionItem(Expression expression) protected voidRender any database-specific introducer immediately before a primary table reference.protected voidrenderQuantifiedEmulationSubQuery(QuerySpec subQuery, ComparisonOperator tupleComparisonOperator) protected final voidRender a query group without its order-by and offset/fetch clauses.protected final voidprotected voidrenderRecursiveCteVirtualSelections(SelectClause selectClause) protected <X extends Expression>
voidrenderRelationalEmulationSubQuery(QuerySpec subQuery, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator) protected voidrenderRowNumber(SelectClause selectClause, QueryPart queryPart) protected voidrenderRowNumberingSelectItems(SelectClause selectClause, QueryPart queryPart) protected voidrenderRowsToClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderRowsToClause(QuerySpec querySpec) protected voidprotected voidrenderSelectClause(SelectClause selectClause) Render the select clause after the base has established its clause-stack invariant.protected voidrenderSelectExpression(Expression expression) protected voidprotected voidrenderSelectItems(SelectClause selectClause) protected voidrenderSelectSimpleComparison(List<SqlSelection> lhsExpressions, Expression expression, ComparisonOperator operator) protected voidrenderSelectStatement(SelectStatement statement) Render the SQL for a select statement after the base has established its statement-stack and parameter-rendering-mode invariants.protected voidrenderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator) protected voidrenderSetAssignment(Assignment assignment) protected final voidrenderSetAssignmentEmulateJoin(Assignment assignment, UpdateStatement statement) protected final voidrenderSetClause(List<Assignment> assignments) protected voidrenderSkipFirstClause(Expression offsetExpression, Expression fetchExpression) protected voidrenderSkipFirstClause(QuerySpec querySpec) protected voidrenderSortExpression(Expression sortExpression, boolean ignoreCase) protected final voidrenderStandardConflictClause(ConflictClause conflictClause) protected final voidprotected final voidprotected voidrenderStandardTableInsert(TableInsertStandard tableInsert) protected voidrenderStandardTableUpdate(TableUpdateStandard tableUpdate) protected final voidrenderStatementPrefix(Consumer<SqlAppender> renderer) Render and atomically prepend a statement-level SQL prefix without exposing the mutable main SQL buffer.protected voidrenderStringContainsExactlyPredicate(Expression haystack, Expression needle) protected voidrenderTableReferenceAlias(String alias, TableReferenceAliasContext context) Render a table-reference alias in its semantic statement context.protected final voidrenderTableReferenceIdentificationVariable(TableReference tableReference) protected final booleanrenderTenantRestriction(ColumnValueBinding binding, String qualifier) Render an equality restriction whose null parameter denotes a root tenant.protected voidrenderTopClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean addOffset, boolean needsParenthesis) protected voidrenderTopClause(QuerySpec querySpec, boolean addOffset, boolean needsParenthesis) protected voidrenderTopStartAtClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType) protected voidrenderTopStartAtClause(QuerySpec querySpec) protected voidrenderTupleComparisonStandard(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator) protected voidrenderUpdateClause(UpdateStatement updateStatement) protected final voidrenderUpdateStatementAsInlineView(UpdateStatement statement) protected final voidrenderUpdateStatementAsMerge(UpdateStatement statement) protected final voidprotected final voidrenderUpdateStatementAsTupleSet(UpdateStatement statement) protected final voidrenderUpdateStatementDirect(UpdateStatement statement) protected final voidrenderValuesListAsSelectUnion(List<Values> valuesList) protected final voidrenderValuesListStandard(List<Values> valuesList) protected final voidrenderValuesTableReferenceWithSelectListAliases(ValuesTableReference tableReference) protected final voidrenderVirtualSelections(SelectClause selectClause) protected voidrenderWrappedParameter(JdbcParameter jdbcParameter) protected ExpressionresolveAliasedExpression(List<SqlSelection> sqlSelections, Expression expression) protected ExpressionresolveAliasedExpression(Expression expression) protected ExpressionresolveExpressionToAlias(Expression expression) protected final voidsetLockingTarget(QuerySpec querySpec) protected booleanshouldEmulateLateralWithIntersect(QueryPart queryPart) protected booleanshouldInlineCte(TableGroup tableGroup) Whether CTEs should be inlined rather than rendered as CTEs.protected voidsimpleColumnWriteFragmentRendering(ColumnWriteFragment columnWriteFragment) final Ttranslate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) Perform this translator's one translation.protected final booleanuseOffsetFetchClause(QueryPart queryPart) voidvisitAggregateColumnWriteExpression(AggregateColumnWriteExpression aggregateColumnWriteExpression) protected voidvisitAnsiCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, Consumer<Expression> resultRenderer) protected voidvisitAnsiCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, Consumer<Expression> resultRenderer) voidprotected voidvisitArithmeticOperand(Expression expression) voidvisitAssignment(Assignment assignment) voidvisitBetweenPredicate(BetweenPredicate betweenPredicate) voidvisitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression) voidvisitBooleanExpressionPredicate(BooleanExpressionPredicate booleanExpressionPredicate) final voidvisitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression) protected voidvisitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, boolean inSelect) final voidvisitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression) protected voidvisitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, boolean inSelect) voidvisitCastTarget(CastTarget castTarget) voidvisitCollation(Collation collation) voidvisitColumnReference(ColumnReference columnReference) voidvisitColumnWriteFragment(ColumnWriteFragment columnWriteFragment) voidvisitConversion(Conversion conversion) final voidvisitCteContainer(CteContainer cteContainer) voidvisitCustomTableDelete(TableDeleteCustomSql tableDelete) voidvisitCustomTableInsert(TableInsertCustomSql tableInsert) voidvisitCustomTableUpdate(TableUpdateCustomSql tableUpdate) protected voidvisitDecodeCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression) protected final voidvisitDeleteClause(DeleteStatement statement) final voidvisitDeleteStatement(DeleteStatement statement) protected voidvisitDeleteStatementOnly(DeleteStatement statement) voidvisitDistinct(Distinct distinct) voidvisitDuration(Duration duration) voidvoidvisitEmbeddableTypeLiteral(EmbeddableTypeLiteral expression) voidvisitEntityTypeLiteral(EntityTypeLiteral expression) voidvisitEvery(Every every) voidvisitExistsPredicate(ExistsPredicate existsPredicate) voidvisitExtractUnit(ExtractUnit extractUnit) voidvoidvisitFilterPredicate(FilterPredicate filterPredicate) voidvisitFormat(Format format) protected voidvisitForUpdateClause(QuerySpec querySpec) final voidvisitFromClause(FromClause fromClause) final voidvisitFunctionTableReference(FunctionTableReference tableReference) protected final voidvisitGroupByClause(QuerySpec querySpec, SelectItemReferenceStrategy referenceStrategy) voidvisitGroupedPredicate(GroupedPredicate groupedPredicate) protected final voidvisitHavingClause(QuerySpec querySpec) voidvisitInArrayPredicate(InArrayPredicate inArrayPredicate) voidvisitInListPredicate(InListPredicate inListPredicate) final voidvisitInsertStatement(InsertSelectStatement statement) voidvisitInSubQueryPredicate(InSubQueryPredicate inSubQueryPredicate) voidvisitJdbcLiteral(JdbcLiteral<?> jdbcLiteral) voidvisitJunction(Junction junction) voidvisitLikePredicate(LikePredicate likePredicate) voidfinal voidvisitNamedTableReference(NamedTableReference tableReference) voidvisitNegatedPredicate(NegatedPredicate negatedPredicate) voidvisitNestedColumnReference(NestedColumnReference nestedColumnReference) voidvisitNullnessPredicate(NullnessPredicate nullnessPredicate) voidvisitOffsetFetchClause(QueryPart queryPart) voidvisitOptionalTableUpdate(OptionalTableUpdate tableUpdate) protected voidvisitOrderBy(List<SortSpecification> sortSpecifications) voidprotected final voidvisitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications) protected voidvisitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications, FrameMode mode, FrameKind startKind, Expression startExpression, FrameKind endKind, Expression endExpression, FrameExclusion exclusion, boolean orderedSetAggregate) voidvisitOverflow(Overflow overflow) voidvisitParameter(JdbcParameter jdbcParameter) protected voidvisitParameterAsParameter(JdbcParameter jdbcParameter) protected final voidvisitPartitionByClause(List<Expression> partitionExpressions) protected final voidvisitPartitionExpressions(List<Expression> partitionExpressions, Function<Expression, Expression> resolveAliasExpression, boolean inlineParametersOfAliasedExpressions) protected final voidvisitPartitionExpressions(List<Expression> partitionExpressions, SelectItemReferenceStrategy referenceStrategy) protected voidvisitQueryClauses(QuerySpec querySpec) voidvisitQueryGroup(QueryGroup queryGroup) voidvisitQueryLiteral(QueryLiteral<?> queryLiteral) final voidvisitQueryPartTableReference(QueryPartTableReference tableReference) voidvisitQuerySpec(QuerySpec querySpec) protected voidvisitRecursivePath(Expression recursivePath, int sizeEstimate) Renders the recursive path, possibly wrapping a cast expression around it, to make sure a type with proper size is chosen.voidvisitRelationalPredicate(ComparisonPredicate comparisonPredicate) final voidvisitSelectClause(SelectClause selectClause) final voidvisitSelectStatement(SelectStatement statement) voidvisitSelfRenderingExpression(SelfRenderingExpression expression) voidvisitSelfRenderingPredicate(SelfRenderingPredicate selfRenderingPredicate) protected final voidvisitSetAssignment(Assignment assignment) protected voidvisitSortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase) final voidvisitSortSpecification(SortSpecification sortSpecification) voidvisitSqlFragmentPredicate(SqlFragmentPredicate predicate) protected voidvisitSqlSelectExpression(Expression expression) final voidvisitSqlSelection(SqlSelection sqlSelection) voidvisitSqlSelectionExpression(SqlSelectionExpression expression) final voidvisitStandardTableDelete(TableDeleteStandard tableDelete) final voidvisitStandardTableInsert(TableInsertStandard tableInsert) final voidvisitStandardTableUpdate(TableUpdateStandard tableUpdate) voidvoidvisitSummarization(Summarization every) final voidvisitTableGroup(TableGroup tableGroup) final voidvisitTableGroupJoin(TableGroupJoin tableGroupJoin) final voidvisitTableReferenceJoin(TableReferenceJoin tableReferenceJoin) voidvisitThruthnessPredicate(ThruthnessPredicate thruthnessPredicate) voidvisitTrimSpecification(TrimSpecification trimSpecification) voidvisitTuple(SqlTuple tuple) voidvisitUnaryOperationExpression(UnaryOperation unaryOperationExpression) <N extends Number>
voidvisitUnparsedNumericLiteral(UnparsedNumericLiteral<N> literal) protected final voidvisitUpdateClause(UpdateStatement statement) final voidvisitUpdateStatement(UpdateStatement statement) protected voidvisitUpdateStatementOnly(UpdateStatement statement) protected final voidvisitValuesList(List<Values> valuesList) final voidvisitValuesTableReference(ValuesTableReference tableReference) protected final voidvisitWhereClause(Predicate whereClauseRestrictions) protected final voidwithoutLateralDerivedTableContext(Runnable renderer) protected voidwithParameterRenderingMode(SqlAstNodeRenderingMode renderingMode, Runnable runnable) protected final voidwithRowNumbering(QueryPart queryPart, boolean needsSelectAliases, Runnable r)
-
Constructor Details
-
AbstractSqlAstTranslator
@SPI(IMPLEMENT) protected AbstractSqlAstTranslator(SqlAstTranslationRequest<? extends Statement, T> request) Creates a translator for one complete, typed translation request.
Subclass constructors should only initialize immutable dialect-specific state. Translation does not begin until
SqlAstTranslator.translate(JdbcParameterBindings, QueryOptions)is invoked.
-
-
Method Details
-
getTranslationRequest
-
setLockingTarget
-
getSqlAst
Description copied from interface:SqlAstTranslatorThe SQL AST assigned to this translator.- Specified by:
getSqlAstin interfaceSqlAstTranslator<T extends JdbcOperation>
-
getDialect
-
getSessionFactory
Description copied from interface:SqlAstTranslatorThe SessionFactory whose services are used during translation.- Specified by:
getSessionFactoryin interfaceSqlAstTranslator<T extends JdbcOperation>
-
castFunction
-
getWrapperOptions
-
getIntegerType
-
getStringType
-
getBooleanType
-
getSql
-
renderStatementPrefix
Render and atomically prepend a statement-level SQL prefix without exposing the mutable main SQL buffer. -
getSqlBuffer
-
getParameterBinders
-
getAffectedTableNames
Description copied from interface:SqlAstTranslatorNot the best spot for this. Returns the table names collected while walking the SQL AST. It's 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:
getAffectedTableNamesin interfaceSqlAstTranslator<T extends JdbcOperation>
-
addAffectedTableName
Description copied from interface:SqlAstTranslatorRegister an affected physical table name while translating a mutation.- Specified by:
addAffectedTableNamein interfaceSqlAstTranslator<T extends JdbcOperation>
-
getStatement
-
getCurrentDmlStatement
-
getParameterRenderingMode
-
addAdditionalWherePredicate
-
appendSql
Description copied from interface:SqlAppenderAdd the passed fragment into the in-flight buffer- Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(char fragment) - Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(int value) - Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(long value) - Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(double value) - Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(float value) - Specified by:
appendSqlin interfaceSqlAppender
-
appendSql
public void appendSql(boolean value) - Specified by:
appendSqlin interfaceSqlAppender
-
appendDoubleQuoteEscapedString
- Specified by:
appendDoubleQuoteEscapedStringin interfaceSqlAppender
-
appendSingleQuoteEscapedString
- Specified by:
appendSingleQuoteEscapedStringin interfaceSqlAppender
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceSqlAppender
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceSqlAppender
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceSqlAppender
-
getJdbcServices
-
getJdbcParameterBindings
-
getLockOptions
-
getLimit
-
hasLimit
protected final boolean hasLimit() -
hasLimit
-
hasOffset
-
useOffsetFetchClause
-
isRowsOnlyFetchClauseType
-
getOffsetParameter
-
getLimitParameter
-
getLiteralValue
Description copied from interface:SqlAstTranslatorReturns the literal value of the given expression, inlining a parameter value if necessary.- Specified by:
getLiteralValuein interfaceSqlAstTranslator<T extends JdbcOperation>
-
interpretExpression
protected <R> R interpretExpression(Expression expression, JdbcParameterBindings jdbcParameterBindings) -
renderExpressionAsLiteral
protected void renderExpressionAsLiteral(Expression expression, JdbcParameterBindings jdbcParameterBindings) -
getParameterBindValue
-
getLeftHandExpression
-
inOverOrWithinGroupClause
protected boolean inOverOrWithinGroupClause() -
getClauseStack
-
getStatementStack
-
getQueryPartStack
-
getCurrentQueryPart
Description copied from interface:SqlAstTranslatorThe query part at the top of the translator's traversal stack.- Specified by:
getCurrentQueryPartin interfaceSqlAstTranslator<T extends JdbcOperation>
-
getCurrentClauseStack
Description copied from interface:SqlAstTranslatorRead-only access to the translator's current clause stack. Providers should inspect but not mutate this stack.- Specified by:
getCurrentClauseStackin interfaceSqlAstTranslator<T extends JdbcOperation>
-
getCteStatement
-
translate
Description copied from interface:SqlAstTranslatorPerform this translator's one translation.- Specified by:
translatein interfaceSqlAstTranslator<T extends JdbcOperation>- Parameters:
jdbcParameterBindings- parameter values available for literalization and JDBC bindingqueryOptions- execution options which affect translation- Returns:
- the JDBC operation produced from this translator's SQL AST
-
determineUniqueConstraintNameThatMayFail
-
renderColumnWrite
-
visitSelectStatement
- Specified by:
visitSelectStatementin interfaceSqlAstWalker
-
renderSelectStatement
Render the SQL for a select statement after the base has established its statement-stack and parameter-rendering-mode invariants. Overrides may decorate or replace the standard rendering and may delegate tosuperto retain it. -
visitDeleteStatement
- Specified by:
visitDeleteStatementin interfaceSqlAstWalker
-
visitUpdateStatement
- Specified by:
visitUpdateStatementin interfaceSqlAstWalker
-
visitAssignment
- Specified by:
visitAssignmentin interfaceSqlAstWalker
-
visitInsertStatement
- Specified by:
visitInsertStatementin interfaceSqlAstWalker
-
visitDeleteStatementOnly
-
getQueryMutationRenderingSupport
Supplies the strategy which selects query update and delete rendering plans.
Override this hook to compose database-specific plan selection without taking ownership of statement traversal. The returned support must be non-null and must not retain supplied requests or translator state.
-
renderDeleteStatementDirect
-
renderDeleteStatementWithJoinEmulation
protected final void renderDeleteStatementWithJoinEmulation(DeleteStatement statement, @Nullable String targetAlias) -
visitDeleteClause
-
renderDeleteClause
-
visitUpdateStatementOnly
-
renderUpdateStatementDirect
-
renderUpdateStatementAsScalarSubquery
-
visitUpdateClause
-
renderUpdateClause
-
renderDmlTargetTableExpression
-
hasNonTrivialFromClause
-
renderSetClause
-
visitSetAssignment
-
renderSetAssignment
-
renderAssignmentColumn
-
renderSetAssignmentEmulateJoin
protected final void renderSetAssignmentEmulateJoin(Assignment assignment, UpdateStatement statement) -
isStruct
-
isLob
-
getInsertConflictRenderingSupport
@SPI({IMPLEMENT,SUPPLY}) protected InsertConflictRenderingSupport getInsertConflictRenderingSupport()Supplies the strategy which selects insert-conflict rendering plans.
Override this hook when the database's native or emulated conflict syntax differs from
StandardInsertConflictRenderingSupport.CONSTRAINT_VIOLATION. The returned support must be non-null and must not retain supplied requests or translator state. -
isIntegerDivisionEmulationRequired
-
renderInsertStatementAsMerge
-
renderUpdateStatementAsMerge
-
renderUpdateStatementAsInlineView
-
renderUpdateStatementAsTupleSet
-
renderMergeUpdateClause
@SPI(IMPLEMENT) protected void renderMergeUpdateClause(List<Assignment> assignments, Predicate wherePredicate) -
visitValuesList
-
renderValuesListStandard
-
renderValuesListAsSelectUnion
-
getLockingClauseStrategy
-
visitForUpdateClause
-
getEffectiveLockMode
-
getEffectiveLockMode
-
getEffectiveLockMode
-
getEffectiveLockTimeout
-
hasAggregateFunctions
-
determineLockingStrategy
protected AbstractSqlAstTranslator.LockStrategy determineLockingStrategy(QuerySpec querySpec, Locking.FollowOn followOnStrategy) -
renderStandardConflictClause
-
renderOnDuplicateKeyConflictClause
protected final void renderOnDuplicateKeyConflictClause(InsertSelectStatement statement, ConflictClause conflictClause, InsertConflictRenderingPlan.OnDuplicateKey plan) -
getReturningRenderingSupport
Supplies the strategy which selects how mutations return generated column values.
Override this hook to select a trailing clause or data-change-table plan; leave column traversal and SQL emission to the translator. The returned support must be non-null and must not retain supplied requests.
-
visitCteContainer
-
getCteParameterRenderingMode
The parameter rendering mode to use while rendering a CTE container. -
determineCyclePathColumnName
-
isInRecursiveQueryPart
protected boolean isInRecursiveQueryPart() -
isInSubquery
protected boolean isInSubquery() -
needsCteInlining
protected boolean needsCteInlining()Whether CTEs should be inlined rather than rendered as CTEs. -
shouldInlineCte
Whether CTEs should be inlined rather than rendered as CTEs. -
renderMaterializationHint
-
renderSearchClause
-
renderStandardSearchClause
-
renderCycleClause
-
renderStandardCycleClause
-
renderCycleUsingClause
Render the optional path column of a standard CTE cycle clause. -
renderRecursiveCteVirtualSelections
-
emulateSearchClauseOrderWithRowAndArray
-
visitRecursivePath
Renders the recursive path, possibly wrapping a cast expression around it, to make sure a type with proper size is chosen. -
emulateCycleClauseWithRowAndArray
-
getArrayContainsFunction
Returns the name of thearray_contains(array, element)function, which is used for emulating the cycle clause. -
renderStringContainsExactlyPredicate
-
castNumberToString
Casts a number expression to a string with the given precision and scale. -
visitQueryGroup
- Specified by:
visitQueryGroupin interfaceSqlAstWalker
-
renderQueryGroupWithoutOrderByAndOffsetFetch
Render a query group without its order-by and offset/fetch clauses. This supports dialect grammars which render those clauses on an outer wrapper. -
afterQueryGroup
-
beforeQueryGroup
-
visitQuerySpec
- Specified by:
visitQuerySpecin interfaceSqlAstWalker
-
visitQueryClauses
-
getGroupBySelectItemReferenceStrategy
@SPI({IMPLEMENT,SUPPLY}) protected SelectItemReferenceStrategy getGroupBySelectItemReferenceStrategy()Select how this translator refers to select items in a
group byclause.Return one non-null stable choice without mutating the request or renderer state. Override this focused hook instead of replacing group-by traversal.
- Returns:
- the select-item reference strategy
- Since:
- 8.0
- See Also:
-
visitWhereClause
-
hasWhere
-
resolveAliasedExpression
-
resolveAliasedExpression
protected Expression resolveAliasedExpression(List<SqlSelection> sqlSelections, Expression expression) -
resolveExpressionToAlias
-
visitGroupByClause
protected final void visitGroupByClause(QuerySpec querySpec, SelectItemReferenceStrategy referenceStrategy) -
visitPartitionByClause
-
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
-
visitHavingClause
-
visitOrderBy
-
renderOrderByClause
Render a standard order-by clause, including its leading whitespace. -
renderEmptyOrderBy
protected void renderEmptyOrderBy()Render the ordering required by a window with no sort specifications. The default implementation renders nothing. -
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 >= 1and then want to remove rows wherea = 1 and (b, c) <= (2, 3) -
renderExpressionsAsSubquery
-
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
-
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) -
renderComparisonEmulateDecode
protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs, SqlAstNodeRenderingMode firstArgRenderingMode) -
renderComparisonEmulateCase
protected void renderComparisonEmulateCase(Expression lhs, ComparisonOperator operator, Expression rhs) -
renderComparisonEmulateIntersect
protected void renderComparisonEmulateIntersect(Expression lhs, ComparisonOperator operator, Expression rhs) -
visitSortSpecification
- Specified by:
visitSortSpecificationin interfaceSqlAstWalker
-
visitSortSpecification
protected void visitSortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase) -
renderSortExpression
-
emulateSortSpecificationNullPrecedence
protected void emulateSortSpecificationNullPrecedence(Expression sortExpression, Nulls nullPrecedence) -
getPaginationRenderingSupport
Supplies the strategy which selects SQL AST pagination plans.
This hook controls pagination represented in the SQL AST. It is distinct from
LimitHandler, which rewrites already-rendered SQL for execution-time query limits. The returned support must be non-null and must not retain supplied requests. -
determinePaginationRenderingPlan
-
visitOffsetFetchClause
- Specified by:
visitOffsetFetchClausein interfaceSqlAstWalker
-
renderOffsetFetchClause
-
renderOffsetFetchClause
protected void renderOffsetFetchClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean renderOffsetRowsKeyword) -
renderOffset
-
renderFetch
protected void renderFetch(Expression fetchExpression, Expression offsetExpressionToAdd, FetchClauseType fetchClauseType) -
renderOffsetExpression
-
renderFetchExpression
-
renderTopClause
-
renderTopClause
protected void renderTopClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean addOffset, boolean needsParenthesis) -
renderTopStartAtClause
-
renderTopStartAtClause
protected void renderTopStartAtClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType) -
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
-
renderFirstSkipClause
-
renderSkipFirstClause
-
renderSkipFirstClause
-
renderFirstClause
-
renderFirstClause
-
renderRowsToClause
-
renderRowsToClause
-
renderCombinedLimitClause
-
renderCombinedLimitClause
-
renderLimitOffsetClause
-
renderLimitOffsetClause
-
assertRowsOnlyFetchClauseType
-
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) -
emulateFetchOffsetWithWindowFunctionsVisitQueryPart
-
withRowNumbering
-
visitSelectClause
- Specified by:
visitSelectClausein interfaceSqlAstWalker
-
renderSelectClause
Render the select clause after the base has established its clause-stack invariant. -
renderCteSelectHint
Render a hint immediately after the firstselectkeyword of the given CTE definition. -
renderSelectItems
-
renderVirtualSelections
-
getSelectItemReference
-
renderRowNumberingSelectItems
-
getFetchClauseTypeForRowNumbering
-
visitOver
- Specified by:
visitOverin 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
-
isParameter
-
getVersionSeedMapping
@SPI(USE) @Nullable protected final EntityVersionMapping getVersionSeedMapping(Expression expression) Returns the version mapping when the expression is Hibernate's generated optimistic-lock version-seed parameter.
This method returns
nullfor every other expression. It does not create the seed value, render the expression, or bind the parameter.- Since:
- 8.0
-
isParameterInterpretation
Whether the expression represents Hibernate's interpretation of an SQM parameter.
Unlike
isParameter(Expression), this method returnsfalsefor an ordinaryJdbcParameter.- Since:
- 8.0
-
isLiteral
-
getSortSpecificationsRowNumbering
protected List<SortSpecification> getSortSpecificationsRowNumbering(SelectClause selectClause, QueryPart queryPart) -
visitSqlSelection
- Specified by:
visitSqlSelectionin interfaceSqlAstWalker
-
visitSqlSelectExpression
-
renderSelectExpression
-
renderExpressionAsClauseItem
-
renderSelectExpressionWithCastedOrInlinedPlainParameters
-
renderCasted
-
renderLiteral
-
visitFromClause
- Specified by:
visitFromClausein interfaceSqlAstWalker
-
hasFrom
-
renderFromClauseSpaces
-
renderFromClauseAfterUpdateSet
-
renderFromClauseExcludingDmlTargetReference
-
renderFromClauseJoiningDmlTargetReference
-
needsLocking
-
renderPrimaryTableReferencePrefix
@SPI(IMPLEMENT) protected void renderPrimaryTableReferencePrefix(PrimaryTableReferenceContext context) Render any database-specific introducer immediately before a primary table reference.
Override this focused hook for grammar such as a required
tableprefix. Do not render the reference itself or change traversal state. -
hasTargetTableCorrelation
-
hasNestedOrTargetTableCorrelation
-
visitValuesTableReference
- Specified by:
visitValuesTableReferencein interfaceSqlAstWalker
-
visitQueryPartTableReference
- Specified by:
visitQueryPartTableReferencein interfaceSqlAstWalker
-
visitFunctionTableReference
- Specified by:
visitFunctionTableReferencein interfaceSqlAstWalker
-
renderNamedSetReturningFunction
@SPI(USE) public final void renderNamedSetReturningFunction(String functionName, List<? extends SqlAstNode> sqlAstArguments, SetReturningFunctionType tupleType, String tableIdentifierVariable, SqlAstNodeRenderingMode argumentRenderingMode) Description copied from interface:SqlAstTranslatorRenders a named set returning function.- Specified by:
renderNamedSetReturningFunctionin interfaceSqlAstTranslator<T extends JdbcOperation>
-
getSetReturningFunctionRenderingSupport
@SPI({IMPLEMENT,SUPPLY}) protected SetReturningFunctionRenderingSupport getSetReturningFunctionRenderingSupport()Supplies the strategy which selects named set-returning-function plans.
Override this hook to select native invocation, wrapping, or ordinality emulation while leaving argument traversal and SQL emission to the translator. The support must not be
nulland must not retain a supplied request. -
renderQueryPartTableReferenceWithSelectListAliases
protected final void renderQueryPartTableReferenceWithSelectListAliases(QueryPartTableReference tableReference) -
renderValuesTableReferenceWithSelectListAliases
protected final void renderValuesTableReferenceWithSelectListAliases(ValuesTableReference tableReference) -
renderDerivedTableReferenceIdentificationVariable
protected final void renderDerivedTableReferenceIdentificationVariable(DerivedTableReference tableReference) -
getDerivedTableRenderingSupport
Supplies the strategy which selects derived-table rendering plans.
Override this hook to customize query-part, values-table, or function-table syntax without overriding their traversal callbacks. The returned support must be non-null and must not retain supplied requests or translator state.
-
isRenderingLateralDerivedTable
protected final boolean isRenderingLateralDerivedTable() -
isRenderingDerivedTable
-
withoutLateralDerivedTableContext
-
renderTableReferenceIdentificationVariable
@SPI(USE) protected final void renderTableReferenceIdentificationVariable(TableReference tableReference) -
renderTableReferenceAlias
@SPI(IMPLEMENT) protected void renderTableReferenceAlias(String alias, TableReferenceAliasContext context) Render a table-reference alias in its semantic statement context.
Override this hook when target-table alias syntax differs from ordinary from-clause alias syntax. Implementations must render the supplied alias exactly once and must not retain the context.
-
registerAffectedTable
-
registerAffectedTable
-
getTableJoinRenderingSupport
Supplies the strategy which selects table-join rendering plans.
Override this hook for contextual alternatives such as comma joins or
applysyntax. The translator remains responsible for predicates and traversal. The support must not benulland must not retain a supplied request. -
determineLateralEmulationPredicate
-
shouldEmulateLateralWithIntersect
-
visitTableGroup
- Specified by:
visitTableGroupin interfaceSqlAstWalker
-
visitTableGroupJoin
- Specified by:
visitTableGroupJoinin interfaceSqlAstWalker
-
visitNamedTableReference
- Specified by:
visitNamedTableReferencein interfaceSqlAstWalker
-
visitTableReferenceJoin
- Specified by:
visitTableReferenceJoinin interfaceSqlAstWalker
-
visitColumnReference
- Specified by:
visitColumnReferencein interfaceSqlAstWalker
-
visitNestedColumnReference
- Specified by:
visitNestedColumnReferencein interfaceSqlAstWalker
-
visitAggregateColumnWriteExpression
public void visitAggregateColumnWriteExpression(AggregateColumnWriteExpression aggregateColumnWriteExpression) - Specified by:
visitAggregateColumnWriteExpressionin interfaceSqlAstWalker
-
determineColumnReferenceQualifier
-
visitExtractUnit
- Specified by:
visitExtractUnitin interfaceSqlAstWalker
-
visitDurationUnit
- Specified by:
visitDurationUnitin interfaceSqlAstWalker
-
visitFormat
- Specified by:
visitFormatin interfaceSqlAstWalker
-
visitStar
- Specified by:
visitStarin interfaceSqlAstWalker
-
visitTrimSpecification
- Specified by:
visitTrimSpecificationin interfaceSqlAstWalker
-
visitCastTarget
- Specified by:
visitCastTargetin interfaceSqlAstWalker
-
visitDistinct
- Specified by:
visitDistinctin interfaceSqlAstWalker
-
visitOverflow
- Specified by:
visitOverflowin interfaceSqlAstWalker
-
visitParameter
- Specified by:
visitParameterin interfaceSqlAstWalker
-
visitParameterAsParameter
-
renderWrappedParameter
-
renderParameterAsParameter
Renders a parameter marker for the given position -
addParameterBinder
-
addParameterBinder
protected final int addParameterBinder(JdbcParameter parameter, JdbcParameterBinder parameterBinder) -
render
Description copied from interface:SqlAstTranslatorRender the given SQL AST node using the requested expression mode and the current translator context.- Specified by:
renderin interfaceSqlAstTranslator<T extends JdbcOperation>
-
withParameterRenderingMode
-
visitTuple
- Specified by:
visitTuplein interfaceSqlAstWalker
-
renderCommaSeparated
-
renderCommaSeparatedSelectExpression
protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions) -
renderCommaSeparatedSelectExpression
protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions, Iterable<String> aliases) -
visitCollation
- Specified by:
visitCollationin interfaceSqlAstWalker
-
visitSqlSelectionExpression
- Specified by:
visitSqlSelectionExpressionin interfaceSqlAstWalker
-
visitEntityTypeLiteral
- Specified by:
visitEntityTypeLiteralin interfaceSqlAstWalker
-
visitEmbeddableTypeLiteral
- Specified by:
visitEmbeddableTypeLiteralin interfaceSqlAstWalker
-
visitBinaryArithmeticExpression
- Specified by:
visitBinaryArithmeticExpressionin interfaceSqlAstWalker
-
visitArithmeticOperand
-
visitDuration
- Specified by:
visitDurationin interfaceSqlAstWalker
-
renderInterval
-
renderIntervalLiteral
-
visitConversion
- Specified by:
visitConversionin interfaceSqlAstWalker
-
visitCaseSearchedExpression
- Specified by:
visitCaseSearchedExpressionin interfaceSqlAstWalker
-
visitCaseSearchedExpression
protected void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, boolean inSelect) -
visitAnsiCaseSearchedExpression
protected void visitAnsiCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, Consumer<Expression> resultRenderer) -
visitDecodeCaseSearchedExpression
-
visitCaseSimpleExpression
- Specified by:
visitCaseSimpleExpressionin interfaceSqlAstWalker
-
visitCaseSimpleExpression
protected void visitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, boolean inSelect) -
visitAnsiCaseSimpleExpression
protected void visitAnsiCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, Consumer<Expression> resultRenderer) -
areAllResultsParameters
-
areAllResultsParameters
-
visitAny
- Specified by:
visitAnyin interfaceSqlAstWalker
-
visitEvery
- Specified by:
visitEveryin interfaceSqlAstWalker
-
visitSummarization
- Specified by:
visitSummarizationin interfaceSqlAstWalker
-
visitJdbcLiteral
- Specified by:
visitJdbcLiteralin interfaceSqlAstWalker
-
visitQueryLiteral
- Specified by:
visitQueryLiteralin interfaceSqlAstWalker
-
visitUnparsedNumericLiteral
- Specified by:
visitUnparsedNumericLiteralin interfaceSqlAstWalker
-
renderNull
-
renderAsLiteral
-
visitUnaryOperationExpression
- Specified by:
visitUnaryOperationExpressionin interfaceSqlAstWalker
-
visitModifiedSubQueryExpression
- Specified by:
visitModifiedSubQueryExpressionin interfaceSqlAstWalker
-
visitSelfRenderingPredicate
- Specified by:
visitSelfRenderingPredicatein interfaceSqlAstWalker
-
visitSelfRenderingExpression
- Specified by:
visitSelfRenderingExpressionin interfaceSqlAstWalker
-
visitBooleanExpressionPredicate
- Specified by:
visitBooleanExpressionPredicatein interfaceSqlAstWalker
-
visitBetweenPredicate
- Specified by:
visitBetweenPredicatein interfaceSqlAstWalker
-
visitFilterPredicate
- Specified by:
visitFilterPredicatein interfaceSqlAstWalker
-
visitFilterFragmentPredicate
- Specified by:
visitFilterFragmentPredicatein interfaceSqlAstWalker
-
visitSqlFragmentPredicate
- Specified by:
visitSqlFragmentPredicatein interfaceSqlAstWalker
-
visitGroupedPredicate
- Specified by:
visitGroupedPredicatein interfaceSqlAstWalker
-
visitInListPredicate
- Specified by:
visitInListPredicatein interfaceSqlAstWalker
-
preferUnionQueryForTupleInListPredicate
protected boolean preferUnionQueryForTupleInListPredicate() -
renderExpressionsAsValuesSubquery
-
visitInArrayPredicate
- Specified by:
visitInArrayPredicatein interfaceSqlAstWalker
-
visitInSubQueryPredicate
- Specified by:
visitInSubQueryPredicatein interfaceSqlAstWalker
-
emulateSubQueryRelationalRestrictionPredicate
protected <X extends Expression> void emulateSubQueryRelationalRestrictionPredicate(Predicate predicate, boolean negated, SelectStatement selectStatement, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator) -
renderRelationalEmulationSubQuery
protected <X extends Expression> void renderRelationalEmulationSubQuery(QuerySpec subQuery, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator) -
emulateQuantifiedTupleSubQueryPredicate
protected void emulateQuantifiedTupleSubQueryPredicate(Predicate predicate, SelectStatement selectStatement, 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. -
renderQuantifiedEmulationSubQuery
protected void renderQuantifiedEmulationSubQuery(QuerySpec subQuery, ComparisonOperator tupleComparisonOperator) -
renderFetchFirstRow
protected void renderFetchFirstRow() -
visitExistsPredicate
- Specified by:
visitExistsPredicatein interfaceSqlAstWalker
-
visitJunction
- Specified by:
visitJunctionin interfaceSqlAstWalker
-
visitLikePredicate
- Specified by:
visitLikePredicatein interfaceSqlAstWalker
-
renderLikePredicate
-
renderEscapeCharacter
-
renderCaseInsensitiveLikeEmulation
protected void renderCaseInsensitiveLikeEmulation(Expression lhs, Expression rhs, Expression escapeCharacter, boolean negated) -
renderLikePattern
-
renderBackslashEscapedLikePattern
protected void renderBackslashEscapedLikePattern(Expression pattern, Expression escapeCharacter, boolean noBackslashEscapes) -
appendBackslashEscapedLikeLiteral
protected void appendBackslashEscapedLikeLiteral(SqlAppender appender, String literal, boolean noBackslashEscapes) -
visitNegatedPredicate
- Specified by:
visitNegatedPredicatein interfaceSqlAstWalker
-
visitNullnessPredicate
- Specified by:
visitNullnessPredicatein interfaceSqlAstWalker
-
visitThruthnessPredicate
- Specified by:
visitThruthnessPredicatein interfaceSqlAstWalker
-
visitRelationalPredicate
- Specified by:
visitRelationalPredicatein interfaceSqlAstWalker
-
getSingleRowTableExpression
The reusable single-row table expression supplied by the Dialect. -
getSelectOnlyFromClause
The complete optionalfromfragment for an otherwise table-less select. -
visitStandardTableInsert
- Specified by:
visitStandardTableInsertin interfaceSqlAstWalker
-
renderLegacyReturningInsert
Temporary escape hatch for the legacy H2 identity-returning path, which renders an additional statement and cannot be expressed as a single returning plan.- Returns:
trueif this method rendered the complete insert
-
renderStandardTableInsert
-
renderInsertInto
-
renderIntoIntoAndTable
Renders theinsert into <table name>portion of an insert -
renderInsertIntoNoColumns
Render a complete
insert intostatement for an insert with no column value bindings.Override this method when the database uses syntax other than the generic
values ( )form. CallrenderIntoIntoAndTable(TableInsertStandard)when the standard table rendering and affected-table registration are appropriate, then append the database-specific no-column syntax. If the database cannot express this operation, throw aMappingExceptionwhich identifies the affected table and Dialect.- Parameters:
tableInsert- the supported model insert to render- Since:
- 8.0
-
visitCustomTableInsert
- Specified by:
visitCustomTableInsertin interfaceSqlAstWalker
-
visitStandardTableUpdate
- Specified by:
visitStandardTableUpdatein interfaceSqlAstWalker
-
renderStandardTableUpdate
-
visitOptionalTableUpdate
- Specified by:
visitOptionalTableUpdatein interfaceSqlAstWalker
-
renderTenantRestriction
Render an equality restriction whose null parameter denotes a root tenant. Qualify both references when a merge exposes source and target columns. -
applySqlComment
-
visitCustomTableUpdate
- Specified by:
visitCustomTableUpdatein interfaceSqlAstWalker
-
visitStandardTableDelete
- Specified by:
visitStandardTableDeletein interfaceSqlAstWalker
-
visitCustomTableDelete
- Specified by:
visitCustomTableDeletein interfaceSqlAstWalker
-
visitColumnWriteFragment
- Specified by:
visitColumnWriteFragmentin interfaceSqlAstWalker
-
simpleColumnWriteFragmentRendering
-