HHH-11220 - Auto-detect SQL Server 2016 when the major version is 13

This commit is contained in:
Steve Ebersole 2016-11-08 18:53:48 -06:00
parent a356a08d4b
commit 36d6563998
2 changed files with 21 additions and 8 deletions

View File

@ -149,19 +149,32 @@ public class StandardDialectResolver implements DialectResolver {
final int majorVersion = info.getDatabaseMajorVersion(); final int majorVersion = info.getDatabaseMajorVersion();
switch ( majorVersion ) { switch ( majorVersion ) {
case 8: case 8: {
return new SQLServerDialect(); return new SQLServerDialect();
case 9: }
case 9: {
return new SQLServer2005Dialect(); return new SQLServer2005Dialect();
case 10: }
case 10: {
return new SQLServer2008Dialect(); return new SQLServer2008Dialect();
}
case 11: case 11:
case 12: case 12:
case 13: {
return new SQLServer2012Dialect(); return new SQLServer2012Dialect();
default: }
LOG.unknownSqlServerVersion( majorVersion ); default: {
if ( majorVersion < 8 ) {
LOG.unknownSqlServerVersion( majorVersion, SQLServerDialect.class );
return new SQLServerDialect();
}
else {
// assume `majorVersion > 13`
LOG.unknownSqlServerVersion( majorVersion, SQLServer2012Dialect.class );
return new SQLServer2012Dialect();
}
}
} }
return new SQLServerDialect();
} }
if ( "Sybase SQL Server".equals( databaseName ) || "Adaptive Server Enterprise".equals( databaseName ) ) { if ( "Sybase SQL Server".equals( databaseName ) || "Adaptive Server Enterprise".equals( databaseName ) ) {

View File

@ -1339,8 +1339,8 @@ public interface CoreMessageLogger extends BasicLogger {
void unknownOracleVersion(int databaseMajorVersion); void unknownOracleVersion(int databaseMajorVersion);
@LogMessage(level = WARN) @LogMessage(level = WARN)
@Message(value = "Unknown Microsoft SQL Server major version [%s] using SQL Server 2000 dialect", id = 385) @Message(value = "Unknown Microsoft SQL Server major version [%s] using [%s] dialect", id = 385)
void unknownSqlServerVersion(int databaseMajorVersion); void unknownSqlServerVersion(int databaseMajorVersion, Class<? extends Dialect> dialectClass);
@LogMessage(level = WARN) @LogMessage(level = WARN)
@Message(value = "ResultSet had no statement associated with it, but was not yet registered", id = 386) @Message(value = "ResultSet had no statement associated with it, but was not yet registered", id = 386)