Package org.hibernate.dialect
Class SQLServerSqlAstTranslator<T extends JdbcOperation>
- java.lang.Object
-
- org.hibernate.sql.ast.spi.AbstractSqlAstTranslator<T>
-
- org.hibernate.dialect.SqlAstTranslatorWithMerge<T>
-
- org.hibernate.dialect.SQLServerSqlAstTranslator<T>
-
- All Implemented Interfaces:
Appendable
,SqlAppender
,SqlAstTranslator<T>
,SqlAstWalker
public class SQLServerSqlAstTranslator<T extends JdbcOperation> extends SqlAstTranslatorWithMerge<T>
A SQL AST translator for SQL Server.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.sql.ast.spi.AbstractSqlAstTranslator
AbstractSqlAstTranslator.ForUpdateClause, AbstractSqlAstTranslator.LockStrategy, 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 Constructor Description SQLServerSqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.hibernate.dialect.SQLServerSqlAstTranslator.OffsetFetchClauseMode
getOffsetFetchClauseMode(QueryPart queryPart)
protected boolean
needsRecursiveKeywordInWithClause()
Whether the SQL with clause requires the "recursive" keyword for recursive CTEs.protected boolean
needsRowsToSkip()
protected void
renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs)
protected void
renderEmptyOrderBy()
protected void
renderForUpdateClause(QuerySpec querySpec, AbstractSqlAstTranslator.ForUpdateClause forUpdateClause)
protected void
renderMergeStatement(OptionalTableUpdate optionalTableUpdate)
Renders the OptionalTableUpdate as a MERGE query.protected boolean
renderNamedTableReference(NamedTableReference tableReference, LockMode lockMode)
protected void
renderOrderBy(boolean addWhitespace, List<SortSpecification> sortSpecifications)
protected void
renderPartitionItem(Expression expression)
protected boolean
renderPrimaryTableReference(TableGroup tableGroup, LockMode lockMode)
protected void
renderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
protected void
renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGroupJoin> tableGroupJoinCollector)
protected boolean
shouldEmulateFetchClause(QueryPart queryPart)
protected boolean
supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax.protected boolean
supportsRowValueConstructorSyntaxInInList()
If the dialect supportsrow values
, does it offer such support in IN lists as well?protected boolean
supportsRowValueConstructorSyntaxInQuantifiedPredicates()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates.protected boolean
supportsSimpleQueryGrouping()
protected boolean
supportsWithClauseInSubquery()
Whether the SQL with clause is supported within a subquery.void
visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
void
visitOffsetFetchClause(QueryPart queryPart)
void
visitQueryGroup(QueryGroup queryGroup)
void
visitQuerySpec(QuerySpec querySpec)
void
visitSelectClause(SelectClause selectClause)
protected void
visitSqlSelections(SelectClause selectClause)
-
Methods inherited from class org.hibernate.dialect.SqlAstTranslatorWithMerge
createMergeOperation, renderMergeDelete, renderMergeInsert, renderMergeInto, renderMergeOn, renderMergeSourceAlias, renderMergeTargetAlias, renderMergeUpdate, renderMergeUsing, renderMergeUsingQuerySelection
-
Methods inherited from class org.hibernate.sql.ast.spi.AbstractSqlAstTranslator
addAdditionalWherePredicate, addAppliedParameterBinding, append, append, append, appendBackslashEscapedLikeLiteral, appendSql, appendSql, appendSql, appendSql, appendSql, applyParameter, areAllResultsParameters, areAllResultsParameters, assertRowsOnlyFetchClauseType, castFunction, castNumberToString, cleanup, determineCyclePathColumnName, determineLateralEmulationPredicate, determineLockingStrategy, determineWhereClauseRestrictionWithJoinEmulation, emulateCycleClauseWithRowAndArray, emulateFetchOffsetWithWindowFunctions, emulateFetchOffsetWithWindowFunctions, emulateFetchOffsetWithWindowFunctionsVisitQueryPart, emulateQuantifiedTupleSubQueryPredicate, emulateQueryPartTableReferenceColumnAliasing, emulateSearchClauseOrderWithRowAndArray, emulateSelectTupleComparison, emulateSortSpecificationNullPrecedence, emulateSubQueryRelationalRestrictionPredicate, emulateTupleComparison, emulateValuesTableReferenceColumnAliasing, getAffectedTableNames, getAppliedParameterBindings, getArrayContainsFunction, getBooleanType, getClauseStack, getCteStatement, getCurrentClauseStack, getCurrentCteStatement, getCurrentDmlStatement, getCurrentQueryPart, getDialect, getDmlTargetTableAlias, getEffectiveLockMode, getEffectiveLockMode, getEffectiveLockTimeout, getFetchClauseTypeForRowNumbering, getForShare, getForUpdate, getForUpdateWithClause, getFromDual, getFromDualForSelectOnly, getIntegerType, getJdbcLockStrategy, getJdbcParameterBindings, getJdbcServices, getLeftHandExpression, getLimit, getLimitParameter, getLockOptions, getMaxRows, getNoWait, getOffsetParameter, getParameterBinders, getParameterBindValue, getParameterRenderingMode, getQueryPartForRowNumbering, getQueryPartStack, getRowsToSkip, getSelectItemReference, getSessionFactory, getSkipLocked, getSortSpecificationsRowNumbering, getSql, getSqlAppender, getSqlBuffer, getSqlTypeName, getStatement, getStringType, getWrapperOptions, hasAggregateFunctions, hasLimit, hasLimit, hasNestedTableGroupsToRender, hasOffset, inlineCteTableGroup, inOverOrWithinGroupClause, interpretExpression, isCorrelated, isInRecursiveQueryPart, isLiteral, isParameter, isRowNumberingCurrentQueryPart, isRowsOnlyFetchClauseType, isStruct, needsCteInlining, needsLocking, needsMaxRows, prepareLimitOffsetParameters, processNestedTableGroupJoins, processTableGroupJoin, processTableGroupJoins, registerAffectedTable, registerAffectedTable, render, renderAsLiteral, renderBackslashEscapedLikePattern, renderCaseInsensitiveLikeEmulation, renderCasted, renderCombinedLimitClause, renderCombinedLimitClause, renderCommaSeparated, renderCommaSeparatedSelectExpression, renderCommaSeparatedSelectExpression, renderComparisonDistinctOperator, renderComparisonEmulateCase, renderComparisonEmulateDecode, renderComparisonEmulateIntersect, renderComparisonStandard, renderCteColumns, renderCycleClause, renderDerivedTableReference, renderExpressionAsClauseItem, renderExpressionAsLiteral, renderExpressionsAsSubquery, renderFetch, renderFetchExpression, renderFetchPlusOffsetExpression, renderFetchPlusOffsetExpressionAsLiteral, renderFetchPlusOffsetExpressionAsSingleParameter, renderFirstClause, renderFirstClause, renderFirstSkipClause, renderFirstSkipClause, renderInsertIntoNoColumns, renderIntoIntoAndTable, renderLimitOffsetClause, renderLimitOffsetClause, renderLiteral, renderMaterializationHint, renderOffset, renderOffsetExpression, renderOffsetFetchClause, renderOffsetFetchClause, renderParameterAsParameter, renderParameterAsParameter, renderQueryGroup, renderRecursiveCteVirtualSelections, renderRootTableGroup, renderRowNumber, renderRowNumberingSelectItems, renderRowsToClause, renderRowsToClause, renderSearchClause, renderSelectExpression, renderSelectExpressionWithCastedOrInlinedPlainParameters, renderSelectSimpleComparison, renderSetClause, renderSkipFirstClause, renderSkipFirstClause, rendersTableReferenceAlias, renderStandardCycleClause, renderStandardSearchClause, renderTableGroup, renderTableReferenceIdentificationVariable, renderTableReferenceJoins, renderTopClause, renderTopClause, renderTopStartAtClause, renderTopStartAtClause, renderTupleComparisonStandard, renderVirtualSelections, resolveAliasedExpression, resolveAliasedExpression, resolveExpressionToAlias, setLimitParameter, setOffsetParameter, shouldEmulateLateralWithIntersect, shouldInlineCte, simpleColumnWriteFragmentRendering, supportsArrayConstructor, supportsDistinctFromPredicate, supportsDuplicateSelectItemsInQueryGroup, supportsFilterClause, supportsIntersect, supportsJoinInMutationStatementSubquery, supportsNestedSubqueryCorrelation, supportsNestedWithClause, supportsNullPrecedence, supportsQuantifiedPredicates, supportsRecursiveClauseArrayAndRowEmulation, supportsRecursiveCycleClause, supportsRecursiveCycleUsingClause, supportsRecursiveSearchClause, supportsRowConstructor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsRowValueConstructorSyntaxInInSubQuery, supportsRowValueConstructorSyntaxInSet, supportsWithClause, translate, translateDelete, translateInsert, translateSelect, translateUpdate, useOffsetFetchClause, visitAggregateColumnWriteExpression, visitAnsiCaseSearchedExpression, visitAnsiCaseSimpleExpression, visitAny, visitAssignment, visitBetweenPredicate, visitBooleanExpressionPredicate, visitCaseSearchedExpression, visitCaseSearchedExpression, visitCaseSimpleExpression, visitCaseSimpleExpression, visitCastTarget, visitCollation, visitColumnReference, visitColumnWriteFragment, visitConversion, visitCteContainer, visitCteDefinition, visitCustomTableDelete, visitCustomTableInsert, visitCustomTableUpdate, visitDecodeCaseSearchedExpression, visitDeleteStatement, visitDeleteStatementOnly, visitDistinct, visitDuration, visitDurationUnit, visitEntityTypeLiteral, visitEvery, visitExistsPredicate, visitExtractUnit, visitFilterFragmentPredicate, visitFilterPredicate, visitFormat, visitForUpdateClause, visitFromClause, visitFunctionTableReference, visitGroupByClause, visitGroupedPredicate, visitHavingClause, visitInArrayPredicate, visitInListPredicate, visitInsertStatement, visitInsertStatementOnly, visitInSubQueryPredicate, visitJdbcLiteral, visitJunction, visitLikePredicate, visitModifiedSubQueryExpression, visitNamedTableReference, visitNegatedPredicate, visitNullnessPredicate, visitOrderBy, visitOver, visitOverClause, visitOverClause, visitOverflow, visitParameter, visitParameterAsParameter, visitPartitionByClause, visitPartitionExpressions, visitPartitionExpressions, visitQueryLiteral, visitQueryPartTableReference, visitRecursivePath, visitRelationalPredicate, visitReturningColumns, visitReturningColumns, visitSelectStatement, visitSelfRenderingExpression, visitSelfRenderingPredicate, visitSetAssignment, visitSortSpecification, visitSortSpecification, visitSqlFragmentPredicate, visitSqlSelectExpression, visitSqlSelection, visitSqlSelectionExpression, visitStandardTableDelete, visitStandardTableInsert, visitStandardTableUpdate, visitStar, visitSummarization, visitTableGroup, visitTableGroupJoin, visitTableReferenceJoin, visitTrimSpecification, visitTuple, visitUnaryOperationExpression, visitUpdateStatement, visitUpdateStatementOnly, visitValuesList, visitValuesTableReference, visitWhereClause, withParameterRenderingMode, withRowNumbering
-
-
-
-
Constructor Detail
-
SQLServerSqlAstTranslator
public SQLServerSqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)
-
-
Method Detail
-
needsRecursiveKeywordInWithClause
protected boolean needsRecursiveKeywordInWithClause()
Description copied from class:AbstractSqlAstTranslator
Whether the SQL with clause requires the "recursive" keyword for recursive CTEs.- Overrides:
needsRecursiveKeywordInWithClause
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
supportsWithClauseInSubquery
protected boolean supportsWithClauseInSubquery()
Description copied from class:AbstractSqlAstTranslator
Whether the SQL with clause is supported within a subquery.- Overrides:
supportsWithClauseInSubquery
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderTableGroupJoin
protected void renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGroupJoin> tableGroupJoinCollector)
- Overrides:
renderTableGroupJoin
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderPrimaryTableReference
protected boolean renderPrimaryTableReference(TableGroup tableGroup, LockMode lockMode)
- Overrides:
renderPrimaryTableReference
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderNamedTableReference
protected boolean renderNamedTableReference(NamedTableReference tableReference, LockMode lockMode)
- Overrides:
renderNamedTableReference
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderForUpdateClause
protected void renderForUpdateClause(QuerySpec querySpec, AbstractSqlAstTranslator.ForUpdateClause forUpdateClause)
- Overrides:
renderForUpdateClause
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
getOffsetFetchClauseMode
protected org.hibernate.dialect.SQLServerSqlAstTranslator.OffsetFetchClauseMode getOffsetFetchClauseMode(QueryPart queryPart)
-
supportsSimpleQueryGrouping
protected boolean supportsSimpleQueryGrouping()
- Overrides:
supportsSimpleQueryGrouping
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
shouldEmulateFetchClause
protected boolean shouldEmulateFetchClause(QueryPart queryPart)
-
visitQueryGroup
public void visitQueryGroup(QueryGroup queryGroup)
- Specified by:
visitQueryGroup
in interfaceSqlAstWalker
- Overrides:
visitQueryGroup
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
visitQuerySpec
public void visitQuerySpec(QuerySpec querySpec)
- Specified by:
visitQuerySpec
in interfaceSqlAstWalker
- Overrides:
visitQuerySpec
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
visitSelectClause
public void visitSelectClause(SelectClause selectClause)
- Specified by:
visitSelectClause
in interfaceSqlAstWalker
- Overrides:
visitSelectClause
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
needsRowsToSkip
protected boolean needsRowsToSkip()
- Overrides:
needsRowsToSkip
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
visitSqlSelections
protected void visitSqlSelections(SelectClause selectClause)
- Overrides:
visitSqlSelections
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderOrderBy
protected void renderOrderBy(boolean addWhitespace, List<SortSpecification> sortSpecifications)
- Overrides:
renderOrderBy
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderEmptyOrderBy
protected void renderEmptyOrderBy()
-
visitOffsetFetchClause
public void visitOffsetFetchClause(QueryPart queryPart)
- Specified by:
visitOffsetFetchClause
in interfaceSqlAstWalker
- Overrides:
visitOffsetFetchClause
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderComparison
protected void renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs)
- Overrides:
renderComparison
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderSelectTupleComparison
protected void renderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
- Overrides:
renderSelectTupleComparison
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
renderPartitionItem
protected void renderPartitionItem(Expression expression)
- Overrides:
renderPartitionItem
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
visitBinaryArithmeticExpression
public void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
- Specified by:
visitBinaryArithmeticExpression
in interfaceSqlAstWalker
- Overrides:
visitBinaryArithmeticExpression
in classAbstractSqlAstTranslator<T extends JdbcOperation>
-
supportsRowValueConstructorSyntax
protected boolean supportsRowValueConstructorSyntax()
Description copied from class:AbstractSqlAstTranslator
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') ...
- Overrides:
supportsRowValueConstructorSyntax
in classAbstractSqlAstTranslator<T extends JdbcOperation>
- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax; false otherwise.
-
supportsRowValueConstructorSyntaxInInList
protected boolean supportsRowValueConstructorSyntaxInInList()
Description copied from class:AbstractSqlAstTranslator
If the dialect supportsrow values
, does it offer such support in IN lists as well?For example,
... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ...
- Overrides:
supportsRowValueConstructorSyntaxInInList
in classAbstractSqlAstTranslator<T extends JdbcOperation>
- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax in the IN list; false otherwise.
-
supportsRowValueConstructorSyntaxInQuantifiedPredicates
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()
Description copied from class:AbstractSqlAstTranslator
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 ...) ...
- Overrides:
supportsRowValueConstructorSyntaxInQuantifiedPredicates
in classAbstractSqlAstTranslator<T extends JdbcOperation>
- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax with quantified predicates; false otherwise.
-
renderMergeStatement
protected void renderMergeStatement(OptionalTableUpdate optionalTableUpdate)
Description copied from class:SqlAstTranslatorWithMerge
Renders the OptionalTableUpdate as a MERGE query.- Overrides:
renderMergeStatement
in classSqlAstTranslatorWithMerge<T extends JdbcOperation>
-
-