Fix DB2 10.5 testsuite issues

This commit is contained in:
Christian Beikov 2023-07-25 15:47:08 +02:00
parent b0ad374226
commit e83008e75d
4 changed files with 13 additions and 5 deletions

View File

@ -420,7 +420,7 @@ public class DB2LegacySqlAstTranslator<T extends JdbcOperation> extends Abstract
break; break;
} }
} }
renderComparisonEmulateDecode( lhs, operator, rhs ); renderComparisonEmulateDecode( lhs, operator, rhs, SqlAstNodeRenderingMode.NO_UNTYPED );
} }
} }

View File

@ -862,7 +862,7 @@ public class DB2Dialect extends Dialect {
@Override @Override
public boolean supportsIsTrue() { public boolean supportsIsTrue() {
return true; return getDB2Version().isSameOrAfter( 11 );
} }
@Override @Override

View File

@ -444,7 +444,7 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
break; break;
} }
} }
renderComparisonEmulateDecode( lhs, operator, rhs ); renderComparisonEmulateDecode( lhs, operator, rhs, SqlAstNodeRenderingMode.NO_UNTYPED );
} }
} }

View File

@ -3625,17 +3625,25 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
} }
protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs) { protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs) {
renderComparisonEmulateDecode( lhs, operator, rhs, SqlAstNodeRenderingMode.DEFAULT );
}
protected void renderComparisonEmulateDecode(
Expression lhs,
ComparisonOperator operator,
Expression rhs,
SqlAstNodeRenderingMode firstArgRenderingMode) {
switch ( operator ) { switch ( operator ) {
case DISTINCT_FROM: case DISTINCT_FROM:
appendSql( "decode(" ); appendSql( "decode(" );
lhs.accept( this ); render( lhs, firstArgRenderingMode );
appendSql( ',' ); appendSql( ',' );
rhs.accept( this ); rhs.accept( this );
appendSql( ",0,1)=1" ); appendSql( ",0,1)=1" );
break; break;
case NOT_DISTINCT_FROM: case NOT_DISTINCT_FROM:
appendSql( "decode(" ); appendSql( "decode(" );
lhs.accept( this ); render( lhs, firstArgRenderingMode );
appendSql( ',' ); appendSql( ',' );
rhs.accept( this ); rhs.accept( this );
appendSql( ",0,1)=0" ); appendSql( ",0,1)=0" );