Fix LobSchemaUpdateTest failure for sybase and mssql legacy dialects
This commit is contained in:
parent
aa5e1184a5
commit
4893b6d3ab
|
@ -36,6 +36,7 @@ import org.hibernate.dialect.sequence.SequenceSupport;
|
||||||
import org.hibernate.dialect.unique.AlterTableUniqueIndexDelegate;
|
import org.hibernate.dialect.unique.AlterTableUniqueIndexDelegate;
|
||||||
import org.hibernate.dialect.unique.SkipNullableUniqueDelegate;
|
import org.hibernate.dialect.unique.SkipNullableUniqueDelegate;
|
||||||
import org.hibernate.dialect.unique.UniqueDelegate;
|
import org.hibernate.dialect.unique.UniqueDelegate;
|
||||||
|
import org.hibernate.engine.jdbc.Size;
|
||||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||||
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
|
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
|
||||||
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
||||||
|
@ -67,6 +68,7 @@ import org.hibernate.tool.schema.spi.Exporter;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.BasicTypeRegistry;
|
import org.hibernate.type.BasicTypeRegistry;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.TimestampUtcAsJdbcTimestampJdbcType;
|
import org.hibernate.type.descriptor.jdbc.TimestampUtcAsJdbcTimestampJdbcType;
|
||||||
|
@ -113,6 +115,26 @@ public class SQLServerLegacyDialect extends AbstractTransactSQLDialect {
|
||||||
private final StandardSequenceExporter exporter;
|
private final StandardSequenceExporter exporter;
|
||||||
private final UniqueDelegate uniqueDelegate;
|
private final UniqueDelegate uniqueDelegate;
|
||||||
|
|
||||||
|
private final SizeStrategy sizeStrategy = new SizeStrategyImpl() {
|
||||||
|
@Override
|
||||||
|
public Size resolveSize(
|
||||||
|
JdbcType jdbcType,
|
||||||
|
JavaType<?> javaType,
|
||||||
|
Integer precision,
|
||||||
|
Integer scale,
|
||||||
|
Long length) {
|
||||||
|
switch ( jdbcType.getDdlTypeCode() ) {
|
||||||
|
case BLOB:
|
||||||
|
case CLOB:
|
||||||
|
case NCLOB:
|
||||||
|
return Size.length( getDefaultLobLength() );
|
||||||
|
default:
|
||||||
|
return super.resolveSize( jdbcType, javaType, precision, scale, length );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public SQLServerLegacyDialect() {
|
public SQLServerLegacyDialect() {
|
||||||
this( DatabaseVersion.make( 8, 0 ) );
|
this( DatabaseVersion.make( 8, 0 ) );
|
||||||
}
|
}
|
||||||
|
@ -422,6 +444,11 @@ public class SQLServerLegacyDialect extends AbstractTransactSQLDialect {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SizeStrategy getSizeStrategy() {
|
||||||
|
return sizeStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String castPattern(CastType from, CastType to) {
|
public String castPattern(CastType from, CastType to) {
|
||||||
if ( to == CastType.STRING ) {
|
if ( to == CastType.STRING ) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.hibernate.dialect.function.IntegralTimestampaddFunction;
|
||||||
import org.hibernate.dialect.function.SybaseTruncFunction;
|
import org.hibernate.dialect.function.SybaseTruncFunction;
|
||||||
import org.hibernate.dialect.unique.SkipNullableUniqueDelegate;
|
import org.hibernate.dialect.unique.SkipNullableUniqueDelegate;
|
||||||
import org.hibernate.dialect.unique.UniqueDelegate;
|
import org.hibernate.dialect.unique.UniqueDelegate;
|
||||||
|
import org.hibernate.engine.jdbc.Size;
|
||||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||||
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
|
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
|
||||||
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
|
||||||
|
@ -60,6 +61,7 @@ import org.hibernate.sql.ast.tree.select.SelectStatement;
|
||||||
import org.hibernate.sql.exec.spi.JdbcOperation;
|
import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||||
import org.hibernate.type.JavaObjectType;
|
import org.hibernate.type.JavaObjectType;
|
||||||
import org.hibernate.type.NullType;
|
import org.hibernate.type.NullType;
|
||||||
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
|
@ -90,6 +92,29 @@ public class SybaseLegacyDialect extends AbstractTransactSQLDialect {
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
protected final boolean jtdsDriver;
|
protected final boolean jtdsDriver;
|
||||||
|
|
||||||
|
private final SizeStrategy sizeStrategy = new SizeStrategyImpl() {
|
||||||
|
@Override
|
||||||
|
public Size resolveSize(
|
||||||
|
JdbcType jdbcType,
|
||||||
|
JavaType<?> javaType,
|
||||||
|
Integer precision,
|
||||||
|
Integer scale,
|
||||||
|
Long length) {
|
||||||
|
switch ( jdbcType.getDdlTypeCode() ) {
|
||||||
|
case Types.NCLOB:
|
||||||
|
case Types.CLOB:
|
||||||
|
case Types.BLOB:
|
||||||
|
return Size.length( getDefaultLobLength() );
|
||||||
|
case Types.FLOAT:
|
||||||
|
// Sybase ASE allows FLOAT with a precision up to 48
|
||||||
|
if ( precision != null ) {
|
||||||
|
return Size.precision( Math.min( Math.max( precision, 1 ), 48 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.resolveSize( jdbcType, javaType, precision, scale, length );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public SybaseLegacyDialect() {
|
public SybaseLegacyDialect() {
|
||||||
this( DatabaseVersion.make( 11, 0 ) );
|
this( DatabaseVersion.make( 11, 0 ) );
|
||||||
}
|
}
|
||||||
|
@ -169,6 +194,11 @@ public class SybaseLegacyDialect extends AbstractTransactSQLDialect {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SizeStrategy getSizeStrategy() {
|
||||||
|
return sizeStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsNullPrecedence() {
|
public boolean supportsNullPrecedence() {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue