Make LONGX types synonyms for X types again and remove unnecessary case labels
This commit is contained in:
parent
2c80250b0e
commit
fa750a9c26
|
@ -67,9 +67,6 @@ import static org.hibernate.type.SqlTypes.FLOAT;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARBINARY;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.TIME;
|
import static org.hibernate.type.SqlTypes.TIME;
|
||||||
import static org.hibernate.type.SqlTypes.TIMESTAMP;
|
import static org.hibernate.type.SqlTypes.TIMESTAMP;
|
||||||
|
@ -130,11 +127,8 @@ public class InformixDialect extends Dialect {
|
||||||
//these types have no defined length
|
//these types have no defined length
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "byte";
|
return "byte";
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "text";
|
return "text";
|
||||||
|
@ -160,13 +154,13 @@ public class InformixDialect extends Dialect {
|
||||||
);
|
);
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( VARCHAR, columnType( LONGVARCHAR ), this )
|
CapacityDependentDdlType.builder( VARCHAR, columnType( LONG32VARCHAR ), this )
|
||||||
.withTypeCapacity( 255, "varchar($l)" )
|
.withTypeCapacity( 255, "varchar($l)" )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( NVARCHAR, columnType( LONGNVARCHAR ), this )
|
CapacityDependentDdlType.builder( NVARCHAR, columnType( LONG32NVARCHAR ), this )
|
||||||
.withTypeCapacity( 255, "varchar($l)" )
|
.withTypeCapacity( 255, "varchar($l)" )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -73,9 +73,6 @@ import static org.hibernate.type.SqlTypes.DECIMAL;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARBINARY;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NCLOB;
|
import static org.hibernate.type.SqlTypes.NCLOB;
|
||||||
import static org.hibernate.type.SqlTypes.NUMERIC;
|
import static org.hibernate.type.SqlTypes.NUMERIC;
|
||||||
import static org.hibernate.type.SqlTypes.VARBINARY;
|
import static org.hibernate.type.SqlTypes.VARBINARY;
|
||||||
|
@ -157,18 +154,12 @@ public class IngresDialect extends Dialect {
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
return "varbyte($l)";
|
return "varbyte($l)";
|
||||||
//note: 'long byte' is a synonym for 'blob'
|
//note: 'long byte' is a synonym for 'blob'
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "long byte($l)";
|
return "long byte($l)";
|
||||||
//note: 'long varchar' is a synonym for 'clob'
|
//note: 'long varchar' is a synonym for 'clob'
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return "long varchar($l)";
|
return "long varchar($l)";
|
||||||
//note: 'long varchar' is a synonym for 'nclob'
|
//note: 'long varchar' is a synonym for 'nclob'
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
return "long nvarchar($l)";
|
return "long nvarchar($l)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,11 @@ import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import static org.hibernate.dialect.SimpleDatabaseVersion.ZERO_VERSION;
|
import static org.hibernate.dialect.SimpleDatabaseVersion.ZERO_VERSION;
|
||||||
|
import static org.hibernate.type.SqlTypes.BLOB;
|
||||||
import static org.hibernate.type.SqlTypes.CHAR;
|
import static org.hibernate.type.SqlTypes.CHAR;
|
||||||
import static org.hibernate.type.SqlTypes.CLOB;
|
import static org.hibernate.type.SqlTypes.CLOB;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NCHAR;
|
import static org.hibernate.type.SqlTypes.NCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.NCLOB;
|
import static org.hibernate.type.SqlTypes.NCLOB;
|
||||||
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
||||||
|
@ -91,12 +90,14 @@ public class MimerSQLDialect extends Dialect {
|
||||||
return columnType( NCHAR );
|
return columnType( NCHAR );
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
return columnType( NVARCHAR );
|
return columnType( NVARCHAR );
|
||||||
case LONGVARCHAR:
|
|
||||||
return columnType( LONGNVARCHAR );
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return columnType( LONG32NVARCHAR );
|
return columnType( LONG32NVARCHAR );
|
||||||
|
//default length is 1M, which is quite low
|
||||||
|
case BLOB:
|
||||||
|
return "blob($l)";
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return columnType( NCLOB );
|
case NCLOB:
|
||||||
|
return "nclob($l)";
|
||||||
}
|
}
|
||||||
return super.columnType( sqlTypeCode );
|
return super.columnType( sqlTypeCode );
|
||||||
}
|
}
|
||||||
|
@ -112,12 +113,7 @@ public class MimerSQLDialect extends Dialect {
|
||||||
|
|
||||||
//Mimer CHARs are ASCII!!
|
//Mimer CHARs are ASCII!!
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( VARCHAR, columnType( LONGVARCHAR ), "nvarchar(" + getMaxNVarcharLength() + ")", this )
|
CapacityDependentDdlType.builder( VARCHAR, columnType( LONG32VARCHAR ), "nvarchar(" + getMaxNVarcharLength() + ")", this )
|
||||||
.withTypeCapacity( getMaxNVarcharLength(), columnType( VARCHAR ) )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
CapacityDependentDdlType.builder( LONGVARCHAR, columnType( LONGVARCHAR ), "nvarchar(" + getMaxNVarcharLength() + ")", this )
|
|
||||||
.withTypeCapacity( getMaxNVarcharLength(), columnType( VARCHAR ) )
|
.withTypeCapacity( getMaxNVarcharLength(), columnType( VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
|
@ -58,9 +58,6 @@ import static org.hibernate.type.SqlTypes.CLOB;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARBINARY;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NCHAR;
|
import static org.hibernate.type.SqlTypes.NCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.NCLOB;
|
import static org.hibernate.type.SqlTypes.NCLOB;
|
||||||
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
||||||
|
@ -142,9 +139,7 @@ public class RDMSOS2200Dialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "unicode($l)";
|
return "unicode($l)";
|
||||||
case CLOB:
|
case CLOB:
|
||||||
|
@ -153,7 +148,6 @@ public class RDMSOS2200Dialect extends Dialect {
|
||||||
//no 'binary' nor 'varbinary' so use 'blob'
|
//no 'binary' nor 'varbinary' so use 'blob'
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "blob($l)";
|
return "blob($l)";
|
||||||
|
|
|
@ -52,16 +52,23 @@ public class SybaseAnywhereDialect extends SybaseDialect {
|
||||||
@Override
|
@Override
|
||||||
protected String columnType(int sqlTypeCode) {
|
protected String columnType(int sqlTypeCode) {
|
||||||
switch ( sqlTypeCode ) {
|
switch ( sqlTypeCode ) {
|
||||||
|
case DATE:
|
||||||
|
return "date";
|
||||||
|
case TIME:
|
||||||
|
return "time";
|
||||||
case TIMESTAMP:
|
case TIMESTAMP:
|
||||||
return "timestamp";
|
return "timestamp";
|
||||||
case TIMESTAMP_WITH_TIMEZONE:
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
return "timestamp with time zone";
|
return "timestamp with time zone";
|
||||||
|
|
||||||
|
//these types hold up to 2 GB
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return "long varchar";
|
return "long varchar";
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "long nvarchar";
|
return "long nvarchar";
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "long binary";
|
return "long binary";
|
||||||
|
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
return "ntext";
|
return "ntext";
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,6 @@ import static org.hibernate.type.SqlTypes.DOUBLE;
|
||||||
import static org.hibernate.type.SqlTypes.GEOMETRY;
|
import static org.hibernate.type.SqlTypes.GEOMETRY;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NCHAR;
|
import static org.hibernate.type.SqlTypes.NCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.NCLOB;
|
import static org.hibernate.type.SqlTypes.NCLOB;
|
||||||
import static org.hibernate.type.SqlTypes.NUMERIC;
|
import static org.hibernate.type.SqlTypes.NUMERIC;
|
||||||
|
@ -220,8 +218,6 @@ public abstract class AbstractHANADialect extends Dialect {
|
||||||
return columnType( NVARCHAR );
|
return columnType( NVARCHAR );
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return isUseUnicodeStringTypes() ? columnType( LONG32NVARCHAR ) : super.columnType( LONG32VARCHAR );
|
return isUseUnicodeStringTypes() ? columnType( LONG32NVARCHAR ) : super.columnType( LONG32VARCHAR );
|
||||||
case LONGVARCHAR:
|
|
||||||
return isUseUnicodeStringTypes() ? columnType( LONGNVARCHAR ) : super.columnType( LONGVARCHAR );
|
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return isUseUnicodeStringTypes() ? columnType( NCLOB ) : super.columnType( CLOB );
|
return isUseUnicodeStringTypes() ? columnType( NCLOB ) : super.columnType( CLOB );
|
||||||
// map tinyint to smallint since tinyint is unsigned on HANA
|
// map tinyint to smallint since tinyint is unsigned on HANA
|
||||||
|
|
|
@ -65,6 +65,7 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
|
||||||
switch ( sqlTypeCode ) {
|
switch ( sqlTypeCode ) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
return "bit";
|
return "bit";
|
||||||
|
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
//'tinyint' is an unsigned type in Sybase and
|
//'tinyint' is an unsigned type in Sybase and
|
||||||
//SQL Server, holding values in the range 0-255
|
//SQL Server, holding values in the range 0-255
|
||||||
|
@ -73,17 +74,20 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
//it's called 'int' not 'integer'
|
//it's called 'int' not 'integer'
|
||||||
return "int";
|
return "int";
|
||||||
|
|
||||||
case DATE:
|
case DATE:
|
||||||
case TIME:
|
case TIME:
|
||||||
case TIME_WITH_TIMEZONE:
|
|
||||||
case TIMESTAMP:
|
case TIMESTAMP:
|
||||||
|
case TIME_WITH_TIMEZONE:
|
||||||
case TIMESTAMP_WITH_TIMEZONE:
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
return "datetime";
|
return "datetime";
|
||||||
|
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "image";
|
return "image";
|
||||||
case CLOB:
|
case CLOB:
|
||||||
case NCLOB:
|
|
||||||
return "text";
|
return "text";
|
||||||
|
case NCLOB:
|
||||||
|
return "ntext";
|
||||||
}
|
}
|
||||||
return super.columnType( sqlTypeCode );
|
return super.columnType( sqlTypeCode );
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,24 +96,21 @@ public class CockroachDialect extends Dialect {
|
||||||
switch ( sqlTypeCode ) {
|
switch ( sqlTypeCode ) {
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
return "smallint"; //no tinyint
|
return "smallint"; //no tinyint
|
||||||
|
|
||||||
case CHAR:
|
case CHAR:
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
return "string($l)";
|
return "string($l)";
|
||||||
case CLOB:
|
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
case LONG32VARCHAR:
|
case CLOB:
|
||||||
case LONG32NVARCHAR:
|
|
||||||
return "string";
|
return "string";
|
||||||
|
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
return "bytes($l)";
|
return "bytes($l)";
|
||||||
case BLOB:
|
case BLOB:
|
||||||
case LONG32VARBINARY:
|
|
||||||
return "bytes";
|
return "bytes";
|
||||||
}
|
}
|
||||||
return super.columnType( sqlTypeCode );
|
return super.columnType( sqlTypeCode );
|
||||||
|
@ -126,14 +123,11 @@ public class CockroachDialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "string";
|
return "string";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "bytes";
|
return "bytes";
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,22 +120,20 @@ public class DerbyDialect extends Dialect {
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
//no tinyint
|
//no tinyint
|
||||||
return "smallint";
|
return "smallint";
|
||||||
|
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
// HHH-12827: map them both to the same type to avoid problems with schema update
|
// HHH-12827: map them both to the same type to avoid problems with schema update
|
||||||
// Note that 31 is the maximum precision Derby supports
|
// Note that 31 is the maximum precision Derby supports
|
||||||
return columnType( DECIMAL );
|
return columnType( DECIMAL );
|
||||||
|
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
return "varchar($l) for bit data";
|
return "varchar($l) for bit data";
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "long varchar for bit data";
|
return "long varchar for bit data";
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
return columnType( CHAR );
|
return columnType( CHAR );
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
return columnType( VARCHAR );
|
return columnType( VARCHAR );
|
||||||
case LONGNVARCHAR:
|
|
||||||
return columnType( LONGVARCHAR );
|
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return "long varchar";
|
return "long varchar";
|
||||||
case BLOB:
|
case BLOB:
|
||||||
|
@ -161,19 +159,19 @@ public class DerbyDialect extends Dialect {
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( VARBINARY, columnType( BLOB ), columnType( VARBINARY ), this )
|
CapacityDependentDdlType.builder( VARBINARY, columnType( BLOB ), columnType( VARBINARY ), this )
|
||||||
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGVARBINARY ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32VARBINARY ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( VARCHAR, columnType( CLOB ), columnType( VARCHAR ), this )
|
CapacityDependentDdlType.builder( VARCHAR, columnType( CLOB ), columnType( VARCHAR ), this )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGVARCHAR ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( NVARCHAR, columnType( CLOB ), columnType( NVARCHAR ), this )
|
CapacityDependentDdlType.builder( NVARCHAR, columnType( CLOB ), columnType( NVARCHAR ), this )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGVARCHAR ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -181,7 +179,7 @@ public class DerbyDialect extends Dialect {
|
||||||
CapacityDependentDdlType.builder( BINARY, columnType( BLOB ), columnType( VARBINARY ), this )
|
CapacityDependentDdlType.builder( BINARY, columnType( BLOB ), columnType( VARBINARY ), this )
|
||||||
.withTypeCapacity( 254, "char($l) for bit data" )
|
.withTypeCapacity( 254, "char($l) for bit data" )
|
||||||
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGVARBINARY ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32VARBINARY ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -190,14 +188,14 @@ public class DerbyDialect extends Dialect {
|
||||||
CapacityDependentDdlType.builder( CHAR, columnType( CLOB ), columnType( CHAR ), this )
|
CapacityDependentDdlType.builder( CHAR, columnType( CLOB ), columnType( CHAR ), this )
|
||||||
.withTypeCapacity( 254, columnType( CHAR ) )
|
.withTypeCapacity( 254, columnType( CHAR ) )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGVARCHAR ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( NCHAR, columnType( CLOB ), columnType( NCHAR ), this )
|
CapacityDependentDdlType.builder( NCHAR, columnType( CLOB ), columnType( NCHAR ), this )
|
||||||
.withTypeCapacity( 254, columnType( NCHAR ) )
|
.withTypeCapacity( 254, columnType( NCHAR ) )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( NVARCHAR ) )
|
||||||
.withTypeCapacity( maxLongVarcharLength, columnType( LONGNVARCHAR ) )
|
.withTypeCapacity( maxLongVarcharLength, columnType( LONG32NVARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,12 +309,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( simpleSqlType( CHAR ) );
|
ddlTypeRegistry.addDescriptor( simpleSqlType( CHAR ) );
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
sqlTypeBuilder( VARCHAR, LONGVARCHAR, VARCHAR )
|
sqlTypeBuilder( VARCHAR, LONG32VARCHAR, VARCHAR )
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
sqlTypeBuilder( LONGVARCHAR, LONGVARCHAR, VARCHAR )
|
|
||||||
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
.withTypeCapacity( getMaxVarcharLength(), columnType( VARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -322,12 +317,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( simpleSqlType( NCHAR ) );
|
ddlTypeRegistry.addDescriptor( simpleSqlType( NCHAR ) );
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
sqlTypeBuilder( NVARCHAR, LONGNVARCHAR, NVARCHAR )
|
sqlTypeBuilder( NVARCHAR, LONG32NVARCHAR, NVARCHAR )
|
||||||
.withTypeCapacity( getMaxNVarcharLength(), columnType( NVARCHAR ) )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
sqlTypeBuilder( LONGNVARCHAR, LONGNVARCHAR, NVARCHAR )
|
|
||||||
.withTypeCapacity( getMaxNVarcharLength(), columnType( NVARCHAR ) )
|
.withTypeCapacity( getMaxNVarcharLength(), columnType( NVARCHAR ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -335,12 +325,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( simpleSqlType( BINARY ) );
|
ddlTypeRegistry.addDescriptor( simpleSqlType( BINARY ) );
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
sqlTypeBuilder( VARBINARY, LONGVARBINARY, VARBINARY )
|
sqlTypeBuilder( VARBINARY, LONG32VARBINARY, VARBINARY )
|
||||||
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
sqlTypeBuilder( LONGVARBINARY, LONGVARBINARY, VARBINARY )
|
|
||||||
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
.withTypeCapacity( getMaxVarbinaryLength(), columnType( VARBINARY ) )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -448,13 +433,10 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return "blob";
|
return "blob";
|
||||||
|
|
||||||
// by default use the LOB mappings for the "long" types
|
// by default use the LOB mappings for the "long" types
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return columnType( CLOB );
|
return columnType( CLOB );
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return columnType( NCLOB );
|
return columnType( NCLOB );
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return columnType( BLOB );
|
return columnType( BLOB );
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,6 @@ import static org.hibernate.type.SqlTypes.INTERVAL_SECOND;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32NVARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
import static org.hibernate.type.SqlTypes.LONG32VARBINARY;
|
||||||
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
import static org.hibernate.type.SqlTypes.LONG32VARCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.LONGNVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARBINARY;
|
|
||||||
import static org.hibernate.type.SqlTypes.LONGVARCHAR;
|
|
||||||
import static org.hibernate.type.SqlTypes.NCHAR;
|
import static org.hibernate.type.SqlTypes.NCHAR;
|
||||||
import static org.hibernate.type.SqlTypes.NUMERIC;
|
import static org.hibernate.type.SqlTypes.NUMERIC;
|
||||||
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
import static org.hibernate.type.SqlTypes.NVARCHAR;
|
||||||
|
@ -179,12 +176,9 @@ public class H2Dialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
return columnType( CHAR );
|
return columnType( CHAR );
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
return columnType( VARCHAR );
|
return columnType( VARCHAR );
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return columnType( VARBINARY );
|
return columnType( VARBINARY );
|
||||||
}
|
}
|
||||||
|
@ -199,14 +193,11 @@ public class H2Dialect extends Dialect {
|
||||||
return "char";
|
return "char";
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "varchar";
|
return "varchar";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "varbinary";
|
return "varbinary";
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,13 +132,16 @@ public class HSQLDialect extends Dialect {
|
||||||
// Older versions of HSQL did not accept
|
// Older versions of HSQL did not accept
|
||||||
// precision for the 'numeric' type
|
// precision for the 'numeric' type
|
||||||
return "numeric";
|
return "numeric";
|
||||||
|
|
||||||
// Older versions of HSQL had no lob support
|
// Older versions of HSQL had no lob support
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "longvarbinary";
|
return "longvarbinary";
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return "longvarchar";
|
return "longvarchar";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.columnType( sqlTypeCode );
|
return super.columnType( sqlTypeCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,13 @@ public class MySQLDialect extends Dialect {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
// HHH-6935: Don't use "boolean" i.e. tinyint(1) due to JDBC ResultSetMetaData
|
// HHH-6935: Don't use "boolean" i.e. tinyint(1) due to JDBC ResultSetMetaData
|
||||||
return "bit";
|
return "bit";
|
||||||
|
|
||||||
case TIMESTAMP:
|
case TIMESTAMP:
|
||||||
return getMySQLVersion().isBefore( 5, 7 ) ? "datetime" : "datetime($p)";
|
return getMySQLVersion().isBefore( 5, 7 )
|
||||||
|
? "datetime" : "datetime($p)";
|
||||||
case TIMESTAMP_WITH_TIMEZONE:
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
return getMySQLVersion().isBefore( 5, 7 ) ? "timestamp" : "timestamp($p)";
|
return getMySQLVersion().isBefore( 5, 7 )
|
||||||
|
? "timestamp" : "timestamp($p)";
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
// it's just a synonym
|
// it's just a synonym
|
||||||
return columnType( DECIMAL );
|
return columnType( DECIMAL );
|
||||||
|
@ -199,15 +202,12 @@ public class MySQLDialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
//MySQL doesn't let you cast to TEXT/LONGTEXT
|
//MySQL doesn't let you cast to TEXT/LONGTEXT
|
||||||
return "char";
|
return "char";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
//MySQL doesn't let you cast to BLOB/TINYBLOB/LONGBLOB
|
//MySQL doesn't let you cast to BLOB/TINYBLOB/LONGBLOB
|
||||||
return "binary";
|
return "binary";
|
||||||
|
@ -275,34 +275,8 @@ public class MySQLDialect extends Dialect {
|
||||||
}
|
}
|
||||||
ddlTypeRegistry.addDescriptor( varbinaryBuilder.build() );
|
ddlTypeRegistry.addDescriptor( varbinaryBuilder.build() );
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
CapacityDependentDdlType.builder( LONGVARBINARY, columnType( BLOB ), "binary", this )
|
|
||||||
.withTypeCapacity( maxTinyLobLen, "tinyblob" )
|
|
||||||
.withTypeCapacity( maxMediumLobLen, "mediumblob" )
|
|
||||||
.withTypeCapacity( maxLobLen, "blob" )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32VARBINARY, columnType( BLOB ), "binary", this ) );
|
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32VARBINARY, columnType( BLOB ), "binary", this ) );
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
CapacityDependentDdlType.builder( LONGVARCHAR, columnType( CLOB ), "char", this )
|
|
||||||
.withTypeCapacity( maxTinyLobLen, "tinytext" )
|
|
||||||
.withTypeCapacity( maxMediumLobLen, "mediumtext" )
|
|
||||||
.withTypeCapacity( maxLobLen, "text" )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32VARCHAR, columnType( CLOB ), "char", this ) );
|
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32VARCHAR, columnType( CLOB ), "char", this ) );
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
|
||||||
CapacityDependentDdlType.builder( LONGNVARCHAR, columnType( NCLOB ), "char", this )
|
|
||||||
.withTypeCapacity( maxTinyLobLen, "tinytext" )
|
|
||||||
.withTypeCapacity( maxMediumLobLen, "mediumtext" )
|
|
||||||
.withTypeCapacity( maxLobLen, "text" )
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32NVARCHAR, columnType( CLOB ), "char", this ) );
|
ddlTypeRegistry.addDescriptor( new DdlTypeImpl( LONG32NVARCHAR, columnType( CLOB ), "char", this ) );
|
||||||
|
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
|
|
|
@ -554,6 +554,7 @@ public class OracleDialect extends Dialect {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
// still, after all these years...
|
// still, after all these years...
|
||||||
return "number(1,0)";
|
return "number(1,0)";
|
||||||
|
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
return "number(3,0)";
|
return "number(3,0)";
|
||||||
case SMALLINT:
|
case SMALLINT:
|
||||||
|
@ -565,10 +566,12 @@ public class OracleDialect extends Dialect {
|
||||||
case REAL:
|
case REAL:
|
||||||
// Oracle's 'real' type is actually double precision
|
// Oracle's 'real' type is actually double precision
|
||||||
return "float(24)";
|
return "float(24)";
|
||||||
|
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
case DECIMAL:
|
case DECIMAL:
|
||||||
// Note that 38 is the maximum precision Oracle supports
|
// Note that 38 is the maximum precision Oracle supports
|
||||||
return "number($p,$s)";
|
return "number($p,$s)";
|
||||||
|
|
||||||
case DATE:
|
case DATE:
|
||||||
case TIME:
|
case TIME:
|
||||||
return "date";
|
return "date";
|
||||||
|
@ -577,6 +580,8 @@ public class OracleDialect extends Dialect {
|
||||||
// on Oracle is that date has no fractional seconds
|
// on Oracle is that date has no fractional seconds
|
||||||
case TIMESTAMP_WITH_TIMEZONE:
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
return getVersion().isBefore( 9 ) ? "date" : super.columnType( sqlTypeCode );
|
return getVersion().isBefore( 9 ) ? "date" : super.columnType( sqlTypeCode );
|
||||||
|
case TIME_WITH_TIMEZONE:
|
||||||
|
return getVersion().isBefore( 9 ) ? "date" : "timestamp($p) with time zone";
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
return getVersion().isBefore( 9 ) ? "varchar2($l)" : "varchar2($l char)";
|
return getVersion().isBefore( 9 ) ? "varchar2($l)" : "varchar2($l char)";
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
|
|
|
@ -131,22 +131,27 @@ public class PostgreSQLDialect extends Dialect {
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
// no tinyint, not even in Postgres 11
|
// no tinyint, not even in Postgres 11
|
||||||
return "smallint";
|
return "smallint";
|
||||||
|
// there are no nchar/nvarchar types in Postgres
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
return columnType( CHAR );
|
return columnType( CHAR );
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
return columnType( VARCHAR );
|
return columnType( VARCHAR );
|
||||||
case LONGVARCHAR:
|
// since there's no real difference between TEXT and VARCHAR,
|
||||||
|
// except for the length limit, we can just use 'text' for the
|
||||||
|
// "long" string types
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "text";
|
return "text";
|
||||||
case BLOB:
|
case BLOB:
|
||||||
case CLOB:
|
case CLOB:
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
|
// use oid as the blob type on Postgres because
|
||||||
|
// the JDBC driver is rubbish
|
||||||
return "oid";
|
return "oid";
|
||||||
|
// use bytea as the "long" binary type (that there is no
|
||||||
|
// real VARBINARY type in Postgres, so we always use this)
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "bytea";
|
return "bytea";
|
||||||
}
|
}
|
||||||
|
@ -160,14 +165,11 @@ public class PostgreSQLDialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "text";
|
return "text";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "bytea";
|
return "bytea";
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,16 +125,10 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
||||||
// be either between 1 and 8000 or exactly MAX, and
|
// be either between 1 and 8000 or exactly MAX, and
|
||||||
// the length of an NVARCHAR column must be either
|
// the length of an NVARCHAR column must be either
|
||||||
// between 1 and 4000 or exactly MAX. (HHH-3965)
|
// between 1 and 4000 or exactly MAX. (HHH-3965)
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return "varchar(max)";
|
return "varchar(max)";
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
return "nvarchar(max)";
|
return "nvarchar(max)";
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "varbinary(max)";
|
return "varbinary(max)";
|
||||||
case DATE:
|
case DATE:
|
||||||
|
@ -155,17 +149,14 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
||||||
if ( getVersion().isSameOrAfter( 9 ) ) {
|
if ( getVersion().isSameOrAfter( 9 ) ) {
|
||||||
switch ( sqlTypeCode ) {
|
switch ( sqlTypeCode ) {
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return "varchar(max)";
|
return "varchar(max)";
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
return "nvarchar(max)";
|
return "nvarchar(max)";
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "varbinary(max)";
|
return "varbinary(max)";
|
||||||
|
|
|
@ -84,41 +84,41 @@ public class SpannerDialect extends Dialect {
|
||||||
switch ( sqlTypeCode ) {
|
switch ( sqlTypeCode ) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
return "bool";
|
return "bool";
|
||||||
|
|
||||||
case TINYINT:
|
case TINYINT:
|
||||||
case SMALLINT:
|
case SMALLINT:
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
case BIGINT:
|
case BIGINT:
|
||||||
return "int64";
|
return "int64";
|
||||||
|
|
||||||
case REAL:
|
case REAL:
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
case DECIMAL:
|
case DECIMAL:
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
return "float64";
|
return "float64";
|
||||||
|
|
||||||
//there is no time type of any kind
|
//there is no time type of any kind
|
||||||
case TIME:
|
case TIME:
|
||||||
//timestamp does not accept precision
|
//timestamp does not accept precision
|
||||||
case TIMESTAMP:
|
case TIMESTAMP:
|
||||||
case TIMESTAMP_WITH_TIMEZONE:
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
return "timestamp";
|
return "timestamp";
|
||||||
|
|
||||||
case CHAR:
|
case CHAR:
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
return "string($l)";
|
return "string($l)";
|
||||||
case CLOB:
|
|
||||||
case NCLOB:
|
|
||||||
case LONG32VARCHAR:
|
|
||||||
case LONG32NVARCHAR:
|
|
||||||
return "string(max)";
|
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
return "bytes($l)";
|
return "bytes($l)";
|
||||||
|
|
||||||
|
case CLOB:
|
||||||
|
case NCLOB:
|
||||||
|
return "string(max)";
|
||||||
case BLOB:
|
case BLOB:
|
||||||
case LONG32VARBINARY:
|
|
||||||
return "bytes(max)";
|
return "bytes(max)";
|
||||||
}
|
}
|
||||||
return super.columnType( sqlTypeCode );
|
return super.columnType( sqlTypeCode );
|
||||||
|
@ -131,14 +131,11 @@ public class SpannerDialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case VARCHAR:
|
case VARCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONGVARCHAR:
|
|
||||||
case LONGNVARCHAR:
|
|
||||||
case LONG32VARCHAR:
|
case LONG32VARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "string";
|
return "string";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONGVARBINARY:
|
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
return "bytes";
|
return "bytes";
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,33 @@ public class DdlTypeRegistry implements Serializable {
|
||||||
ddlTypes.putIfAbsent( sqlTypeCode, jdbcType );
|
ddlTypes.putIfAbsent( sqlTypeCode, jdbcType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the registered {@link DdlType} for the given SQL type code.
|
||||||
|
* <p>
|
||||||
|
* Not that the "long" types {@link Types#LONGVARCHAR}, {@link Types#LONGNVARCHAR}
|
||||||
|
* and {@link Types#LONGVARBINARY} are considered synonyms for their
|
||||||
|
* non-{@code LONG} counterparts, with the only difference being that
|
||||||
|
* a different default length is used: {@link org.hibernate.Length#LONG}
|
||||||
|
* instead of {@link org.hibernate.Length#DEFAULT}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public DdlType getDescriptor(int sqlTypeCode) {
|
public DdlType getDescriptor(int sqlTypeCode) {
|
||||||
return ddlTypes.get( sqlTypeCode );
|
final DdlType ddlType = ddlTypes.get( sqlTypeCode );
|
||||||
|
if ( ddlType == null ) {
|
||||||
|
switch ( sqlTypeCode ) {
|
||||||
|
// these are no longer considered separate column types as such
|
||||||
|
// they're just used to indicate that JavaType.getLongSqlLength()
|
||||||
|
// should be used by default (and that's already handled by the
|
||||||
|
// time we get to here)
|
||||||
|
case Types.LONGVARCHAR:
|
||||||
|
return ddlTypes.get( Types.VARCHAR );
|
||||||
|
case Types.LONGNVARCHAR:
|
||||||
|
return ddlTypes.get( Types.NVARCHAR );
|
||||||
|
case Types.LONGVARBINARY:
|
||||||
|
return ddlTypes.get( Types.VARBINARY );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ddlType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeName(int typeCode, Dialect dialect) {
|
public String getTypeName(int typeCode, Dialect dialect) {
|
||||||
|
|
Loading…
Reference in New Issue