Use fallback dialect instead of returning null

This commit is contained in:
Lukas Rieger (Blue) 2023-06-12 23:07:00 +02:00
parent f149b823a7
commit 32f15d6555
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,8 @@ public enum DialectType {
MARIADB (MySQLStorage::new, "mariadb"),
POSTGRESQL (PostgreSQLStorage::new,"postgresql");
private static final DialectType FALLBACK = MYSQL;
private final SQLStorageFactory storageFactory;
private final String dialectName;
@ -28,7 +30,9 @@ public enum DialectType {
return dialect.storageFactory.provide(settings);
}
}
return null;
// unknown dialect, use fallback
return FALLBACK.storageFactory.provide(settings);
}
@FunctionalInterface