Minor improvements and tweaks

This commit is contained in:
William committed 2021-10-08 22:16:32 +01:00
1 parent 86d14f6018
commit db9b8fa193
3 files changed
+9 -7

No files matched your search

@@ -8,6 +8,8 @@ import java.sql.SQLException;
public abstract class Database {
protected HuskHomes plugin;
public final static String DATA_POOL_NAME = "HuskHomesHikariPool";
public Database(HuskHomes instance) {
plugin = instance;
}
@@ -98,11 +98,11 @@ public class MySQL extends Database {
dataSource.setMaxLifetime(hikariMaximumLifetime);
dataSource.setKeepaliveTime(hikariKeepAliveTime);
dataSource.setConnectionTimeout(hikariConnectionTimeOut);
dataSource.setPoolName("HuskHomesHikariPool");
dataSource.setPoolName(DATA_POOL_NAME);
// Create tables
try(Connection connection = dataSource.getConnection()) {
try(Statement statement = connection.createStatement()) {
try (Connection connection = dataSource.getConnection()) {
try (Statement statement = connection.createStatement()) {
for (String tableCreationStatement : SQL_SETUP_STATEMENTS) {
statement.execute(tableCreationStatement);
}
@@ -121,6 +121,6 @@ public class MySQL extends Database {
@Override
public void backup() {
plugin.getLogger().info("Remember to make backups of your HuskHomes Database before updating HuskHomes!");
plugin.getLogger().info("Remember to make backups of your HuskHomes Database before updating the plugin!");
}
}
@@ -115,11 +115,11 @@ public class SQLite extends Database {
dataSource.setMaxLifetime(hikariMaximumLifetime);
dataSource.setKeepaliveTime(hikariKeepAliveTime);
dataSource.setConnectionTimeout(hikariConnectionTimeOut);
dataSource.setPoolName("HuskHomesHikariPool");
dataSource.setPoolName(DATA_POOL_NAME);
// Create tables
try(Connection connection = dataSource.getConnection()) {
try(Statement statement = connection.createStatement()) {
try (Connection connection = dataSource.getConnection()) {
try (Statement statement = connection.createStatement()) {
for (String tableCreationStatement : SQL_SETUP_STATEMENTS) {
statement.execute(tableCreationStatement);
}