HHH-12856 Add AS400V7R3Dialect as default for V7R3 of IBM i

This commit is contained in:
Pierrick Rouxel 2019-01-02 23:34:14 +01:00 committed by Andrea Boriero
parent 622978b725
commit 7b1d1a1f3a
2 changed files with 12 additions and 2 deletions

View File

@ -47,7 +47,7 @@ public enum Database {
DB2 {
@Override
public Class<? extends Dialect> latestDialect() {
return DB2400Dialect.class;
return DB2400V7R3Dialect.class;
}
@Override
@ -55,9 +55,18 @@ public enum Database {
final String databaseName = info.getDatabaseName();
if ( "DB2 UDB for AS/400".equals( databaseName ) ) {
return new DB2400Dialect();
final int majorVersion = info.getDatabaseMajorVersion();
final int minorVersion = info.getDatabaseMinorVersion();
if ( majorVersion > 7 || ( majorVersion == 7 && minorVersion >= 3 ) ) {
return latestDialectInstance( this );
}
else {
return new DB2400Dialect();
}
}
if ( databaseName.startsWith( "DB2/" ) ) {
return new DB2Dialect();
}

View File

@ -153,6 +153,7 @@ public class DialectFactoryTest extends BaseUnitTestCase {
testDetermination( "DB2/LINUX390", DB2Dialect.class, resolver );
testDetermination( "DB2/AIX64", DB2Dialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", DB2400Dialect.class, resolver );
testDetermination( "DB2 UDB for AS/400", 7, 3, DB2400V7R3Dialect.class, resolver );
testDetermination( "Oracle", 8, Oracle8iDialect.class, resolver );
testDetermination( "Oracle", 9, Oracle9iDialect.class, resolver );
testDetermination( "Oracle", 10, Oracle10gDialect.class, resolver );