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

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 static SQLStorage getStorage(String dialectName, SQLStorageSettings setti
return dialect.storageFactory.provide(settings);
}
}
return null;
// unknown dialect, use fallback
return FALLBACK.storageFactory.provide(settings);
}
@FunctionalInterface