HHH-10331 - Fix HSQLDialect returns supportsTupleDistinctCounts false which seems wrong
This commit is contained in:
parent
cac8b0d8c5
commit
fcd355f608
|
@ -72,7 +72,7 @@ public class HSQLDialect extends Dialect {
|
|||
@Override
|
||||
public String processSql(String sql, RowSelection selection) {
|
||||
final boolean hasOffset = LimitHelper.hasFirstRow( selection );
|
||||
if (hsqldbVersion < 20) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
return new StringBuilder( sql.length() + 10 )
|
||||
.append( sql )
|
||||
.insert(
|
||||
|
@ -93,14 +93,14 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean bindLimitParametersFirst() {
|
||||
return hsqldbVersion < 20;
|
||||
return hsqldbVersion < 200;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* version is 18 for 1.8 or 20 for 2.0
|
||||
* version is 180 for 1.8.0 or 200 for 2.0.0
|
||||
*/
|
||||
private int hsqldbVersion = 18;
|
||||
private int hsqldbVersion = 180;
|
||||
private final LimitHandler limitHandler;
|
||||
|
||||
|
||||
|
@ -114,8 +114,9 @@ public class HSQLDialect extends Dialect {
|
|||
final Class props = ReflectHelper.classForName( "org.hsqldb.persist.HsqlDatabaseProperties" );
|
||||
final String versionString = (String) props.getDeclaredField( "THIS_VERSION" ).get( null );
|
||||
|
||||
hsqldbVersion = Integer.parseInt( versionString.substring( 0, 1 ) ) * 10;
|
||||
hsqldbVersion += Integer.parseInt( versionString.substring( 2, 3 ) );
|
||||
hsqldbVersion = Integer.parseInt( versionString.substring( 0, 1 ) ) * 100;
|
||||
hsqldbVersion += Integer.parseInt( versionString.substring( 2, 3 ) ) * 10;
|
||||
hsqldbVersion += Integer.parseInt( versionString.substring( 4, 5 ) );
|
||||
}
|
||||
catch ( Throwable e ) {
|
||||
// must be a very old version
|
||||
|
@ -141,7 +142,7 @@ public class HSQLDialect extends Dialect {
|
|||
registerColumnType( Types.VARCHAR, "varchar($l)" );
|
||||
registerColumnType( Types.VARBINARY, "varbinary($l)" );
|
||||
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
registerColumnType( Types.NUMERIC, "numeric" );
|
||||
}
|
||||
else {
|
||||
|
@ -149,7 +150,7 @@ public class HSQLDialect extends Dialect {
|
|||
}
|
||||
|
||||
//HSQL has no Blob/Clob support .... but just put these here for now!
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
registerColumnType( Types.BLOB, "longvarbinary" );
|
||||
registerColumnType( Types.CLOB, "longvarchar" );
|
||||
}
|
||||
|
@ -183,7 +184,7 @@ public class HSQLDialect extends Dialect {
|
|||
registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
|
||||
|
||||
// datetime functions
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
|
||||
}
|
||||
else {
|
||||
|
@ -240,7 +241,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
// special functions
|
||||
// from v. 2.2.0 ROWNUM() is supported in all modes as the equivalent of Oracle ROWNUM
|
||||
if ( hsqldbVersion > 21 ) {
|
||||
if ( hsqldbVersion > 219 ) {
|
||||
registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.INTEGER ) );
|
||||
}
|
||||
|
||||
|
@ -275,7 +276,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public String getIdentityInsertString() {
|
||||
return hsqldbVersion < 20 ? "null" : "default";
|
||||
return hsqldbVersion < 200 ? "null" : "default";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -285,7 +286,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public String getForUpdateString() {
|
||||
if ( hsqldbVersion >= 20 ) {
|
||||
if ( hsqldbVersion >= 200 ) {
|
||||
return " for update";
|
||||
}
|
||||
else {
|
||||
|
@ -305,7 +306,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public String getLimitString(String sql, boolean hasOffset) {
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
return new StringBuilder( sql.length() + 10 )
|
||||
.append( sql )
|
||||
.insert(
|
||||
|
@ -321,7 +322,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean bindLimitParametersFirst() {
|
||||
return hsqldbVersion < 20;
|
||||
return hsqldbVersion < 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -331,7 +332,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean supportsColumnCheck() {
|
||||
return hsqldbVersion >= 20;
|
||||
return hsqldbVersion >= 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -388,7 +389,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
|
||||
return hsqldbVersion < 20 ? EXTRACTER_18 : EXTRACTER_20;
|
||||
return hsqldbVersion < 200 ? EXTRACTER_18 : EXTRACTER_20;
|
||||
}
|
||||
|
||||
private static final ViolatedConstraintNameExtracter EXTRACTER_18 = new TemplatedViolatedConstraintNameExtracter() {
|
||||
|
@ -516,7 +517,7 @@ public class HSQLDialect extends Dialect {
|
|||
// the definition and data is private to the session and table declaration
|
||||
// can happen in the middle of a transaction
|
||||
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
return new GlobalTemporaryTableBulkIdStrategy(
|
||||
new IdTableSupportStandardImpl() {
|
||||
@Override
|
||||
|
@ -610,7 +611,7 @@ public class HSQLDialect extends Dialect {
|
|||
return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
|
||||
}
|
||||
|
||||
if ( hsqldbVersion < 20 ) {
|
||||
if ( hsqldbVersion < 200 ) {
|
||||
return new ReadUncommittedLockingStrategy( lockable, lockMode );
|
||||
}
|
||||
else {
|
||||
|
@ -634,7 +635,7 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean supportsCommentOn() {
|
||||
return hsqldbVersion >= 20;
|
||||
return hsqldbVersion >= 200;
|
||||
}
|
||||
|
||||
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -651,12 +652,12 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean doesReadCommittedCauseWritersToBlockReaders() {
|
||||
return hsqldbVersion >= 20;
|
||||
return hsqldbVersion >= 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesRepeatableReadCauseReadersToBlockWriters() {
|
||||
return hsqldbVersion >= 20;
|
||||
return hsqldbVersion >= 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -671,7 +672,8 @@ public class HSQLDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public boolean supportsTupleDistinctCounts() {
|
||||
return false;
|
||||
// from v. 2.2.9 is added support for COUNT(DISTINCT ...) with multiple arguments
|
||||
return hsqldbVersion >= 229;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue