From a2756620f55447e84360ca9d754c4d75d0ff9f99 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 16 Jun 2019 16:45:45 +0200 Subject: [PATCH] Show "Updating database finished" message --- src/main/java/de/epiceric/shopchest/sql/Database.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/sql/Database.java b/src/main/java/de/epiceric/shopchest/sql/Database.java index f7a085a..3054879 100644 --- a/src/main/java/de/epiceric/shopchest/sql/Database.java +++ b/src/main/java/de/epiceric/shopchest/sql/Database.java @@ -64,7 +64,7 @@ public abstract class Database { abstract String getQueryGetTable(); - private void update() throws SQLException { + private boolean update() throws SQLException { String queryGetTable = getQueryGetTable(); String queryUpdateVersion = "REPLACE INTO " + tableFields + " VALUES ('version', ?)"; @@ -197,6 +197,8 @@ public abstract class Database { ps.setInt(1, DATABASE_VERSION); ps.executeUpdate(); } + + return needsUpdate1 || needsUpdate2; } } @@ -235,7 +237,9 @@ public abstract class Database { try (Connection con = dataSource.getConnection()) { // Update database structure if necessary - update(); + if (update()) { + plugin.getLogger().info("Updating database finished"); + } // Create shop table try (Statement s = con.createStatement()) {