HHH-14080 fix Dialect-Aware Rendering of Null Value Literals for InformixDialect
This commit is contained in:
parent
76ca5fb790
commit
9e8fe5ca07
|
@ -59,6 +59,7 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||||
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
||||||
import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType;
|
import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType;
|
||||||
import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
|
import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
|
||||||
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate;
|
import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate;
|
||||||
import static org.hibernate.type.SqlTypes.BIGINT;
|
import static org.hibernate.type.SqlTypes.BIGINT;
|
||||||
|
@ -594,4 +595,10 @@ public class InformixDialect extends Dialect {
|
||||||
.replace("S", "%F1");
|
.replace("S", "%F1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration) {
|
||||||
|
String typeName = typeConfiguration.getDdlTypeRegistry().getDescriptor( sqlType).getRawTypeName();
|
||||||
|
return "null::" + typeName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
|
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
|
||||||
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
|
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
import org.hibernate.sql.ast.tree.Statement;
|
import org.hibernate.sql.ast.tree.Statement;
|
||||||
|
@ -143,6 +144,18 @@ public class InformixSqlAstTranslator<T extends JdbcOperation> extends AbstractS
|
||||||
return " from " + getDual() + " dual";
|
return " from " + getDual() + " dual";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderNull(Literal literal) {
|
||||||
|
if ( getParameterRenderingMode() == SqlAstNodeRenderingMode.NO_UNTYPED ) {
|
||||||
|
renderCasted( literal );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int sqlType = literal.getExpressionType().getSingleJdbcMapping().getJdbcType().getJdbcTypeCode();
|
||||||
|
String nullString = getDialect().getSelectClauseNullString( sqlType, getSessionFactory().getTypeConfiguration() );
|
||||||
|
appendSql( nullString );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean supportsParameterOffsetFetchExpression() {
|
private boolean supportsParameterOffsetFetchExpression() {
|
||||||
return getDialect().getVersion().isSameOrAfter( 11 );
|
return getDialect().getVersion().isSameOrAfter( 11 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -7413,7 +7413,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderNull(Literal literal) {
|
protected void renderNull(Literal literal) {
|
||||||
if ( getParameterRenderingMode() == SqlAstNodeRenderingMode.NO_UNTYPED ) {
|
if ( getParameterRenderingMode() == SqlAstNodeRenderingMode.NO_UNTYPED ) {
|
||||||
renderCasted( literal );
|
renderCasted( literal );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue