update the community dialects

This commit is contained in:
Gavin King 2021-12-11 18:33:52 +01:00
parent 0ca7a659b0
commit ccc88e9ad4
9 changed files with 111 additions and 45 deletions

View File

@ -67,13 +67,14 @@ public class CUBRIDDialect extends Dialect {
//'timestamp' has a very limited range
//'datetime' does not support explicit precision
//(always 3, millisecond precision)
registerColumnType(Types.TIMESTAMP, "datetime");
registerColumnType(Types.TIMESTAMP, "datetimetz");
registerColumnType(Types.TIMESTAMP, "datetime" );
registerColumnType(Types.TIMESTAMP, "datetimetz" );
//CUBRID has no 'binary' nor 'varbinary', but 'bit' is
//intended to be used for binary data
registerColumnType( Types.BINARY, "bit($l)");
registerColumnType( Types.VARBINARY, "bit varying($l)");
//intended to be used for binary data (unfortunately the
//length parameter is measured in bits, not bytes)
registerColumnType( Types.BINARY, "bit($l)" );
registerColumnType( Types.VARBINARY, getMaxVarbinaryLength(), "bit varying($l)" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
@ -115,6 +116,17 @@ public class CUBRIDDialect extends Dialect {
registerKeywords( info );
}
@Override
public int getMaxVarcharLength() {
return 1_073_741_823;
}
@Override
public int getMaxVarbinaryLength() {
//note that the length of BIT VARYING in CUBRID is actually in bits
return 1_073_741_823;
}
@Override
public DatabaseVersion getVersion() {
return VERSION;

View File

@ -141,23 +141,12 @@ public class FirebirdDialect extends Dialect {
else {
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp with time zone" );
}
// Single byte character sets can be 32_765 characters, but assume use of UTF8
registerColumnType( Types.VARCHAR, 8_191, "varchar($l)" );
registerColumnType( Types.VARCHAR, "blob sub_type text" );
if ( getVersion().isBefore( 4, 0 ) ) {
registerColumnType( Types.BINARY, 32_767, "char($l) character set octets" );
}
else {
registerColumnType( Types.BINARY, 32_767, "binary($l)" );
}
registerColumnType( Types.BINARY, "blob sub_type binary" );
if ( getVersion().isBefore( 4, 0 ) ) {
registerColumnType( Types.VARBINARY, 32_765, "varchar($l) character set octets" );
}
else {
registerColumnType( Types.VARBINARY, 32_765, "varbinary($l)" );
registerColumnType( Types.BINARY, "char($l) character set octets" );
registerColumnType( Types.VARBINARY, getMaxVarbinaryLength(), "varchar($l) character set octets" );
}
registerColumnType( Types.VARBINARY, "blob sub_type binary" );
@ -168,6 +157,18 @@ public class FirebirdDialect extends Dialect {
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
@Override
public int getMaxVarcharLength() {
// Single byte character sets can be 32_765
// characters, but assume use of UTF8
return 8_191;
}
@Override
public int getMaxVarbinaryLength() {
return 32_756;
}
@Override
public DatabaseVersion getVersion() {
return version;

View File

@ -107,7 +107,7 @@ public class InformixDialect extends Dialect {
registerColumnType( Types.VARBINARY, "byte" );
registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
registerColumnType( Types.VARCHAR, 32_739, "lvarchar($l)" );
registerColumnType( Types.VARCHAR, getMaxVarcharLength(), "lvarchar($l)" );
registerColumnType( Types.VARCHAR, "text" );
uniqueDelegate = new InformixUniqueDelegate( this );
@ -120,6 +120,18 @@ public class InformixDialect extends Dialect {
: new SkipFirstLimitHandler( getVersion().isSameOrAfter( 11 ) );
}
@Override
public int getMaxVarbinaryLength() {
//there's no varbinary type, only byte
return -1;
}
@Override
public int getMaxVarcharLength() {
//the maximum length of an lvarchar
return 32_739;
}
@Override
public DatabaseVersion getVersion() {
return version;

View File

@ -119,10 +119,8 @@ public class IngresDialect extends Dialect {
registerColumnType( Types.NUMERIC, "decimal($p, $s)" ); //Ingres has no 'numeric' type
final int maxStringLength = 32_000;
registerColumnType( Types.BINARY, maxStringLength, "byte($l)" );
registerColumnType( Types.VARBINARY, maxStringLength, "varbyte($l)" );
registerColumnType( Types.BINARY, "byte($l)" );
registerColumnType( Types.VARBINARY, getMaxVarbinaryLength(), "varbyte($l)" );
//note: 'long byte' is a synonym for 'blob'
registerColumnType( Types.VARBINARY, "long byte($l)" );
@ -130,13 +128,13 @@ public class IngresDialect extends Dialect {
// here? I think Ingres char/varchar types don't
// support Unicode. Copy what AbstractHANADialect
// does with a Hibernate property to config this.
registerColumnType( Types.CHAR, maxStringLength, "char($l)" );
registerColumnType( Types.VARCHAR, maxStringLength, "varchar($l)" );
registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.VARCHAR, getMaxVarcharLength(), "varchar($l)" );
//note: 'long varchar' is a synonym for 'clob'
registerColumnType( Types.VARCHAR, "long varchar($l)" );
registerColumnType( Types.NCHAR, maxStringLength, "nchar($l)" );
registerColumnType( Types.NVARCHAR, maxStringLength, "nvarchar($l)" );
registerColumnType( Types.NCHAR, "nchar($l)" );
registerColumnType( Types.NVARCHAR, getMaxNVarcharLength(), "nvarchar($l)" );
//note: 'long nvarchar' is a synonym for 'nclob'
registerColumnType( Types.NVARCHAR, "long nvarchar($l)" );
@ -180,6 +178,20 @@ public class IngresDialect extends Dialect {
return version;
}
@Override
public int getMaxVarcharLength() {
// the maximum possible (configurable) value for
// both varchar and varbyte
return 32_000;
}
@Override
public int getMaxNVarcharLength() {
// the maximum possible (configurable) value for
// nvarchar
return 16_000;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -68,6 +68,12 @@ public class MaxDBDialect extends Dialect {
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
@Override
public int getMaxVarbinaryLength() {
// there's no varbinary type
return -1;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName,

View File

@ -106,17 +106,17 @@ public class RDMSOS2200Dialect extends Dialect {
registerColumnType( Types.BLOB, "blob($l)" );
//no 'binary' nor 'varbinary' so use 'blob'
registerColumnType( Types.BINARY, "blob($l)");
registerColumnType( Types.VARBINARY, "blob($l)");
registerColumnType( Types.BINARY, "blob($l)" );
registerColumnType( Types.VARBINARY, "blob($l)" );
//'varchar' is not supported in RDMS for OS 2200
//(but it is for other flavors of RDMS)
//'character' means ASCII by default, 'unicode(n)'
//means 'character(n) character set "UCS-2"'
registerColumnType( Types.CHAR, "unicode($l)");
registerColumnType( Types.VARCHAR, "unicode($l)");
registerColumnType( Types.CHAR, "unicode($l)" );
registerColumnType( Types.VARCHAR, getMaxVarcharLength(), "unicode($l)" );
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)");
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)" );
}
public RDMSOS2200Dialect(DialectResolutionInfo info) {
@ -124,6 +124,12 @@ public class RDMSOS2200Dialect extends Dialect {
registerKeywords( info );
}
@Override
public int getMaxVarbinaryLength() {
//no varbinary type
return -1;
}
@Override
public DatabaseVersion getVersion() {
return ZERO_VERSION;

View File

@ -112,6 +112,12 @@ public class SQLiteDialect extends Dialect {
uniqueDelegate = new SQLiteUniqueDelegate( this );
}
@Override
public int getMaxVarbinaryLength() {
//no varbinary type
return -1;
}
private static class SQLiteUniqueDelegate extends DefaultUniqueDelegate {
public SQLiteUniqueDelegate(Dialect dialect) {
super( dialect );

View File

@ -93,7 +93,7 @@ public class TeradataDialect extends Dialect {
registerColumnType( Types.TINYINT, "byteint" );
registerColumnType( Types.BINARY, "byte($l)" );
registerColumnType( Types.VARBINARY, "varbyte($l)" );
registerColumnType( Types.VARBINARY, getMaxVarbinaryLength(), "varbyte($l)" );
if ( getVersion().isBefore( 13 ) ) {
registerColumnType( Types.BIGINT, "numeric(19,0)" );
@ -129,6 +129,17 @@ public class TeradataDialect extends Dialect {
}
@Override
public int getMaxVarcharLength() {
//for the unicode server character set
return 32_000;
}
@Override
public int getMaxVarbinaryLength() {
return 64_000;
}
@Override
public JdbcType resolveSqlTypeDescriptor(
String columnTypeName, int jdbcTypeCode,

View File

@ -73,28 +73,28 @@ public class TimesTenDialect extends Dialect {
// TypeMode=0
registerColumnType( Types.BOOLEAN, "tt_tinyint" );
registerColumnType(Types.TINYINT, "tt_tinyint");
registerColumnType(Types.SMALLINT, "tt_smallint");
registerColumnType(Types.INTEGER, "tt_integer");
registerColumnType(Types.BIGINT, "tt_bigint");
registerColumnType( Types.TINYINT, "tt_tinyint" );
registerColumnType( Types.SMALLINT, "tt_smallint" );
registerColumnType( Types.INTEGER, "tt_integer" );
registerColumnType( Types.BIGINT, "tt_bigint" );
//note that 'binary_float'/'binary_double' might
//be better mappings for Java Float/Double
//'numeric'/'decimal' are synonyms for 'number'
registerColumnType(Types.NUMERIC, "number($p,$s)");
registerColumnType(Types.DECIMAL, "number($p,$s)" );
registerColumnType( Types.NUMERIC, "number($p,$s)" );
registerColumnType( Types.DECIMAL, "number($p,$s)" );
registerColumnType( Types.VARCHAR, "varchar2($l)" );
registerColumnType( Types.NVARCHAR, "nvarchar2($l)" );
registerColumnType( Types.VARCHAR, getMaxVarcharLength(), "varchar2($l)" );
registerColumnType( Types.NVARCHAR, getMaxNVarcharLength(), "nvarchar2($l)" );
//do not use 'date' because it's a datetime
registerColumnType(Types.DATE, "tt_date");
registerColumnType( Types.DATE, "tt_date" );
//'time' and 'tt_time' are synonyms
registerColumnType(Types.TIME, "tt_time");
registerColumnType( Types.TIME, "tt_time" );
//`timestamp` has more precision than `tt_timestamp`
// registerColumnType(Types.TIMESTAMP, "tt_timestamp");
registerColumnType(Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)");
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );