HHH-15046: db2 version override for SQLAstTranslator
This commit is contained in:
parent
706bd15222
commit
77ea0c7c1f
|
@ -51,7 +51,7 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
|
|||
|
||||
@Override
|
||||
public void visitBooleanExpressionPredicate(BooleanExpressionPredicate booleanExpressionPredicate) {
|
||||
if ( getDialectVersion().isSameOrAfter( 11 ) ) {
|
||||
if ( getDB2Version().isSameOrAfter( 11 ) ) {
|
||||
booleanExpressionPredicate.getExpression().accept( this );
|
||||
}
|
||||
else {
|
||||
|
@ -132,12 +132,12 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
|
|||
// Check if current query part is already row numbering to avoid infinite recursion
|
||||
return getQueryPartForRowNumbering() != queryPart && (
|
||||
useOffsetFetchClause( queryPart ) && !isRowsOnlyFetchClauseType( queryPart )
|
||||
|| getDialectVersion().isBefore( 11, 1 ) && ( queryPart.isRoot() && hasLimit() || !( queryPart.getFetchClauseExpression() instanceof Literal ) )
|
||||
|| getDB2Version().isBefore( 11, 1 ) && ( queryPart.isRoot() && hasLimit() || !( queryPart.getFetchClauseExpression() instanceof Literal ) )
|
||||
);
|
||||
}
|
||||
|
||||
protected boolean supportsOffsetClause() {
|
||||
return getDialectVersion().isSameOrAfter( 11, 1 );
|
||||
return getDB2Version().isSameOrAfter( 11, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -228,7 +228,7 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
|
|||
|
||||
@Override
|
||||
protected void renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs) {
|
||||
if ( getDialectVersion().isSameOrAfter( 11, 1 ) ) {
|
||||
if ( getDB2Version().isSameOrAfter( 11, 1 ) ) {
|
||||
renderComparisonStandard( lhs, operator, rhs );
|
||||
}
|
||||
else {
|
||||
|
@ -296,12 +296,8 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
|
|||
// For DB2 we use #renderReturningClause to render a wrapper around the DML statement
|
||||
}
|
||||
|
||||
private DatabaseVersion getDialectVersion() {
|
||||
final var dialect = getDialect();
|
||||
if (dialect instanceof DB2Dialect) {
|
||||
return ((DB2Dialect) dialect).getDB2Version();
|
||||
}
|
||||
return dialect.getVersion();
|
||||
public DatabaseVersion getDB2Version() {
|
||||
return this.getDialect().getVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,4 +48,8 @@ public class DB2iSqlAstTranslator<T extends JdbcOperation> extends DB2SqlAstTran
|
|||
renderComparisonStandard( lhs, operator, rhs );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseVersion getDB2Version() {
|
||||
return DatabaseVersion.make(9, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,4 +75,9 @@ public class DB2zSqlAstTranslator<T extends JdbcOperation> extends DB2SqlAstTran
|
|||
append( CLOSE_PARENTHESIS );
|
||||
renderDerivedTableReference( tableReference );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseVersion getDB2Version() {
|
||||
return DatabaseVersion.make(9, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue