use of io.requery.sql.Platform in project requery by requery.
the class PlatformFromConnection method apply.
@Override
public Platform apply(Connection connection) {
Platform platform;
String product;
try {
product = connection.getMetaData().getDatabaseProductName();
} catch (SQLException e) {
throw new PersistenceException(e);
}
if (product.contains("PostgreSQL")) {
platform = new PostgresSQL();
} else if (product.contains("SQLite")) {
platform = new SQLite();
} else if (product.contains("MySQL")) {
platform = new MySQL();
} else if (product.contains("H2")) {
platform = new H2();
} else if (product.contains("HSQL Database Engine")) {
platform = new HSQL();
} else if (product.contains("Apache Derby")) {
platform = new Derby();
} else if (product.contains("Oracle")) {
platform = new Oracle();
} else if (product.contains("Microsoft SQL Server")) {
platform = new SQLServer();
} else {
platform = new Generic();
}
return platform;
}
Aggregations