From ab246cd304694b6fc8bb742eea82af1caf29ea96 Mon Sep 17 00:00:00 2001 From: Pierre Maurice Schwang Date: Fri, 6 Oct 2023 13:26:33 +0200 Subject: [PATCH] chore/feat: log driver version on error --- .../java/com/plotsquared/core/database/SQLManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index e041771f3..3c530b318 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -155,7 +155,8 @@ public class SQLManager implements AbstractDB { this.worldConfiguration = worldConfiguration; this.database = database; this.connection = database.openConnection(); - this.supportsGetGeneratedKeys = this.connection.getMetaData().supportsGetGeneratedKeys(); + final DatabaseMetaData databaseMetaData = this.connection.getMetaData(); + this.supportsGetGeneratedKeys = databaseMetaData.supportsGetGeneratedKeys(); this.mySQL = database instanceof MySQL; this.globalTasks = new ConcurrentLinkedQueue<>(); this.notifyTasks = new ConcurrentLinkedQueue<>(); @@ -165,8 +166,10 @@ public class SQLManager implements AbstractDB { this.prefix = prefix; if (mySQL && !supportsGetGeneratedKeys) { + String driver = databaseMetaData.getDriverName(); + String driverVersion = databaseMetaData.getDriverVersion(); throw new SQLException("Database Driver for MySQL does not support Statement#getGeneratedKeys - which breaks " + - "PlotSquared functionality"); + "PlotSquared functionality (Using " + driver + ":" + driverVersion + ")"); } this.SET_OWNER = "UPDATE `" + this.prefix