HHH-12977 - Update latest dialect for MySQL

This commit is contained in:
Yanming Zhou 2018-09-14 16:52:18 +08:00 committed by Vlad Mihalcea
parent b25bfd79f4
commit a9fd8efe33
4 changed files with 19 additions and 2 deletions

View File

@ -49,6 +49,7 @@ import org.hibernate.dialect.MckoiDialect;
import org.hibernate.dialect.MimerSQLDialect; import org.hibernate.dialect.MimerSQLDialect;
import org.hibernate.dialect.MySQL57Dialect; import org.hibernate.dialect.MySQL57Dialect;
import org.hibernate.dialect.MySQL57InnoDBDialect; import org.hibernate.dialect.MySQL57InnoDBDialect;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.MySQL5InnoDBDialect; import org.hibernate.dialect.MySQL5InnoDBDialect;
import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle10gDialect;
@ -223,6 +224,7 @@ public class StrategySelectorBuilder {
addDialect( strategySelector, MySQL5InnoDBDialect.class ); addDialect( strategySelector, MySQL5InnoDBDialect.class );
addDialect( strategySelector, MySQL57InnoDBDialect.class ); addDialect( strategySelector, MySQL57InnoDBDialect.class );
addDialect( strategySelector, MySQL57Dialect.class ); addDialect( strategySelector, MySQL57Dialect.class );
addDialect( strategySelector, MySQL8Dialect.class );
addDialect( strategySelector, Oracle8iDialect.class ); addDialect( strategySelector, Oracle8iDialect.class );
addDialect( strategySelector, Oracle9iDialect.class ); addDialect( strategySelector, Oracle9iDialect.class );
addDialect( strategySelector, Oracle10gDialect.class ); addDialect( strategySelector, Oracle10gDialect.class );

View File

@ -324,7 +324,7 @@ public enum Database {
MYSQL { MYSQL {
@Override @Override
public Class<? extends Dialect> latestDialect() { public Class<? extends Dialect> latestDialect() {
return MySQL57Dialect.class; return MySQL8Dialect.class;
} }
@Override @Override

View File

@ -113,7 +113,7 @@ public class DialectFactoryTest extends BaseUnitTestCase {
testDetermination( "MySQL", 5, 5, MySQL55Dialect.class, resolver ); testDetermination( "MySQL", 5, 5, MySQL55Dialect.class, resolver );
testDetermination( "MySQL", 5, 6, MySQL55Dialect.class, resolver ); testDetermination( "MySQL", 5, 6, MySQL55Dialect.class, resolver );
testDetermination( "MySQL", 5, 7, MySQL57Dialect.class, resolver ); testDetermination( "MySQL", 5, 7, MySQL57Dialect.class, resolver );
testDetermination( "MySQL", 8, 0, MySQL57Dialect.class, resolver ); testDetermination( "MySQL", 8, 0, MySQL8Dialect.class, resolver );
testDetermination( "MariaDB", "MariaDB connector/J", 10, 3, MariaDB103Dialect.class, resolver ); testDetermination( "MariaDB", "MariaDB connector/J", 10, 3, MariaDB103Dialect.class, resolver );
testDetermination( "MariaDB", "MariaDB connector/J", 10, 2, MariaDB102Dialect.class, resolver ); testDetermination( "MariaDB", "MariaDB connector/J", 10, 2, MariaDB102Dialect.class, resolver );
testDetermination( "MariaDB", "MariaDB connector/J", 10, 1, MariaDB10Dialect.class, resolver ); testDetermination( "MariaDB", "MariaDB connector/J", 10, 1, MariaDB10Dialect.class, resolver );

View File

@ -126,12 +126,27 @@ public class StandardDialectResolverTest extends BaseUnitTestCase {
runMariaDBDialectTest( 5, 2, MariaDBDialect.class ); runMariaDBDialectTest( 5, 2, MariaDBDialect.class );
} }
@Test
public void testResolveDialectInternalForMySQL57() throws SQLException {
runMySQLDialectTest( 5, 7, MySQL57Dialect.class );
}
@Test
public void testResolveDialectInternalForMySQL8() throws SQLException {
runMySQLDialectTest( 8, 0, MySQL8Dialect.class );
}
private static void runMariaDBDialectTest( private static void runMariaDBDialectTest(
int majorVersion, int minorVersion, Class<? extends MariaDBDialect> expectedDialect) int majorVersion, int minorVersion, Class<? extends MariaDBDialect> expectedDialect)
throws SQLException { throws SQLException {
runDialectTest( "MariaDB", "MariaDB connector/J", majorVersion, minorVersion, expectedDialect ); runDialectTest( "MariaDB", "MariaDB connector/J", majorVersion, minorVersion, expectedDialect );
} }
private static void runMySQLDialectTest(
int majorVersion, int minorVersion, Class<? extends MySQLDialect> expectedDialect)
throws SQLException {
runDialectTest( "MySQL", "MySQL connector/J", majorVersion, minorVersion, expectedDialect );
}
private static void runSQLServerDialectTest( private static void runSQLServerDialectTest(
int version, Class<? extends SQLServerDialect> expectedDialect) int version, Class<? extends SQLServerDialect> expectedDialect)