Interface SqlAstTranslator<T extends JdbcOperation>
- All Superinterfaces:
SqlAstWalker
- All Known Implementing Classes:
AbstractSqlAstTranslator, DB2SqlAstTranslator, PostgreSQLFamilySqlAstTranslator, PostgreSQLSqlAstTranslator, SqlAstTranslatorWithMerge, SqlAstTranslatorWithOnDuplicateKeyUpdate, SqlAstTranslatorWithUpsert, StandardSqlAstTranslator
@SPI({USE,IMPLEMENT,SUPPLY})
public interface SqlAstTranslator<T extends JdbcOperation>
extends SqlAstWalker
Translates one [#getSqlAst SQL AST] and produces a JdbcOperation.
Translators are created by a
SqlAstTranslatorFactory for a single
translation and are not reusable. Extend
AbstractSqlAstTranslator for custom SQL
rendering. Implement this contract directly, normally on top of
AbstractSqlAstWalker, when the JDBC driver uses
a fundamentally different command language.
Direct implementations should create query operations with
JdbcOperations. A
SqlAstTranslationRequest.ModelMutation
is not a query operation; create its result through
TableMutation.createMutationOperation(String, List).
- Since:
- 8.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAffectedTableName(String tableName) Register an affected physical table name while translating a mutation.Not the best spot for this.Read-only access to the translator's current clause stack.The query part at the top of the translator's traversal stack.<X> XgetLiteralValue(Expression expression) Returns the literal value of the given expression, inlining a parameter value if necessary.The SessionFactory whose services are used during translation.The SQL AST assigned to this translator.voidrender(SqlAstNode sqlAstNode, SqlAstNodeRenderingMode renderingMode) Render the given SQL AST node using the requested expression mode and the current translator context.voidrenderNamedSetReturningFunction(String functionName, List<? extends SqlAstNode> sqlAstArguments, SetReturningFunctionType tupleType, String tableIdentifierVariable, SqlAstNodeRenderingMode argumentRenderingMode) Renders a named set returning function.translate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) Perform this translator's one translation.Methods inherited from interface SqlAstWalker
visitAggregateColumnWriteExpression, visitAny, visitAssignment, visitBetweenPredicate, visitBinaryArithmeticExpression, visitBooleanExpressionPredicate, visitCaseSearchedExpression, visitCaseSimpleExpression, visitCastTarget, visitCollation, visitColumnReference, visitColumnWriteFragment, visitConversion, visitCustomTableDelete, visitCustomTableInsert, visitCustomTableUpdate, visitDeleteStatement, visitDistinct, visitDuration, visitDurationUnit, visitEmbeddableTypeLiteral, visitEntityTypeLiteral, visitEvery, visitExistsPredicate, visitExtractUnit, visitFilterFragmentPredicate, visitFilterPredicate, visitFormat, visitFromClause, visitFunctionTableReference, visitGroupedPredicate, visitInArrayPredicate, visitInListPredicate, visitInsertStatement, visitInSubQueryPredicate, visitJdbcLiteral, visitJunction, visitLikePredicate, visitModifiedSubQueryExpression, visitNamedTableReference, visitNegatedPredicate, visitNestedColumnReference, visitNullnessPredicate, visitOffsetFetchClause, visitOptionalTableUpdate, visitOver, visitOverflow, visitParameter, visitQueryGroup, visitQueryLiteral, visitQueryPartTableReference, visitQuerySpec, visitRelationalPredicate, visitSelectClause, visitSelectStatement, visitSelfRenderingExpression, visitSelfRenderingPredicate, visitSortSpecification, visitSqlFragmentPredicate, visitSqlSelection, visitSqlSelectionExpression, visitStandardTableDelete, visitStandardTableInsert, visitStandardTableUpdate, visitStar, visitSummarization, visitTableGroup, visitTableGroupJoin, visitTableReferenceJoin, visitThruthnessPredicate, visitTrimSpecification, visitTuple, visitUnaryOperationExpression, visitUnparsedNumericLiteral, visitUpdateStatement, visitValuesTableReference
-
Method Details
-
translate
@SPI({IMPLEMENT,SUPPLY}) T translate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) Perform this translator's one translation.- 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
-
getSqlAst
Statement getSqlAst()The SQL AST assigned to this translator. -
getSessionFactory
SessionFactoryImplementor getSessionFactory()The SessionFactory whose services are used during translation. -
getLiteralValue
Returns the literal value of the given expression, inlining a parameter value if necessary.- Since:
- 7.0
-
renderNamedSetReturningFunction
@Incubating(since="6.0") @SPI(USE) void renderNamedSetReturningFunction(String functionName, List<? extends SqlAstNode> sqlAstArguments, SetReturningFunctionType tupleType, String tableIdentifierVariable, SqlAstNodeRenderingMode argumentRenderingMode) Renders a named set returning function.- Since:
- 7.0
-
render
Render the given SQL AST node using the requested expression mode and the current translator context. -
getCurrentQueryPart
QueryPart getCurrentQueryPart()The query part at the top of the translator's traversal stack. -
getCurrentClauseStack
-
getAffectedTableNames
Not 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. -
addAffectedTableName
Register an affected physical table name while translating a mutation.
-