|
93 | 93 | import java.time.temporal.TemporalAccessor; |
94 | 94 | import java.util.Calendar; |
95 | 95 | import java.util.Date; |
| 96 | +import java.util.Locale; |
96 | 97 | import java.util.TimeZone; |
97 | 98 |
|
98 | 99 | import static java.lang.Integer.parseInt; |
@@ -146,7 +147,7 @@ public class MySQLDialect extends Dialect { |
146 | 147 |
|
147 | 148 | private static final DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 8 ); |
148 | 149 |
|
149 | | - private final MySQLStorageEngine storageEngine = createStorageEngine(); |
| 150 | + private final MySQLStorageEngine storageEngine; |
150 | 151 |
|
151 | 152 | private final SizeStrategy sizeStrategy = new SizeStrategyImpl() { |
152 | 153 | @Override |
@@ -207,14 +208,19 @@ public MySQLDialect(DatabaseVersion version, int bytesPerCharacter) { |
207 | 208 | } |
208 | 209 |
|
209 | 210 | public MySQLDialect(DatabaseVersion version, MySQLServerConfiguration serverConfiguration) { |
210 | | - this( version, serverConfiguration.getBytesPerCharacter(), serverConfiguration.isNoBackslashEscapesEnabled() ); |
| 211 | + super( version ); |
| 212 | + maxVarcharLength = maxVarcharLength( getMySQLVersion(), serverConfiguration.getBytesPerCharacter() ); //conservative assumption |
| 213 | + maxVarbinaryLength = maxVarbinaryLength( getMySQLVersion() ); |
| 214 | + noBackslashEscapesEnabled = serverConfiguration.isNoBackslashEscapesEnabled(); |
| 215 | + storageEngine = createStorageEngine( serverConfiguration.getConfiguredStorageEngine() ); |
211 | 216 | } |
212 | 217 |
|
213 | 218 | public MySQLDialect(DatabaseVersion version, int bytesPerCharacter, boolean noBackslashEscapes) { |
214 | 219 | super( version ); |
215 | 220 | maxVarcharLength = maxVarcharLength( getMySQLVersion(), bytesPerCharacter ); //conservative assumption |
216 | 221 | maxVarbinaryLength = maxVarbinaryLength( getMySQLVersion() ); |
217 | 222 | noBackslashEscapesEnabled = noBackslashEscapes; |
| 223 | + storageEngine = createStorageEngine( Environment.getProperties().getProperty( AvailableSettings.STORAGE_ENGINE ) ); |
218 | 224 | } |
219 | 225 |
|
220 | 226 | public MySQLDialect(DialectResolutionInfo info) { |
@@ -257,13 +263,10 @@ protected void initDefaultProperties() { |
257 | 263 | getDefaultProperties().setProperty( FetchSettings.MAX_FETCH_DEPTH, "2" ); |
258 | 264 | } |
259 | 265 |
|
260 | | - private MySQLStorageEngine createStorageEngine() { |
261 | | - final String storageEngine = |
262 | | - Environment.getProperties() |
263 | | - .getProperty( AvailableSettings.STORAGE_ENGINE ); |
264 | | - return storageEngine == null |
| 266 | + private MySQLStorageEngine createStorageEngine(String configuredStorageEngine) { |
| 267 | + return configuredStorageEngine == null |
265 | 268 | ? getDefaultMySQLStorageEngine() |
266 | | - : switch ( storageEngine ) { |
| 269 | + : switch ( configuredStorageEngine.toLowerCase(Locale.ROOT) ) { |
267 | 270 | case "innodb" -> InnoDBStorageEngine.INSTANCE; |
268 | 271 | case "myisam" -> MyISAMStorageEngine.INSTANCE; |
269 | 272 | default -> throw new UnsupportedOperationException( |
|
0 commit comments