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;
}
}
renderComparisonEmulateDecode( lhs, operator, rhs );
renderComparisonEmulateDecode( lhs, operator, rhs, SqlAstNodeRenderingMode.NO_UNTYPED );
}
}

View File

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

View File

@ -444,7 +444,7 @@ public class DB2SqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAst
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) {
renderComparisonEmulateDecode( lhs, operator, rhs, SqlAstNodeRenderingMode.DEFAULT );
}
protected void renderComparisonEmulateDecode(
Expression lhs,
ComparisonOperator operator,
Expression rhs,
SqlAstNodeRenderingMode firstArgRenderingMode) {
switch ( operator ) {
case DISTINCT_FROM:
appendSql( "decode(" );
lhs.accept( this );
render( lhs, firstArgRenderingMode );
appendSql( ',' );
rhs.accept( this );
appendSql( ",0,1)=1" );
break;
case NOT_DISTINCT_FROM:
appendSql( "decode(" );
lhs.accept( this );
render( lhs, firstArgRenderingMode );
appendSql( ',' );
rhs.accept( this );
appendSql( ",0,1)=0" );