From a147f3fda7099b1c4d4e3cabfd73ea3dc824694a Mon Sep 17 00:00:00 2001 From: tastybento Date: Fri, 28 Jun 2019 16:45:39 -0700 Subject: [PATCH] Fixed bug with SQLite deletion not working. --- .../bentobox/database/sqlite/SQLiteDatabaseHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/database/sqlite/SQLiteDatabaseHandler.java b/src/main/java/world/bentobox/bentobox/database/sqlite/SQLiteDatabaseHandler.java index 54f37561a..3eaf2e908 100644 --- a/src/main/java/world/bentobox/bentobox/database/sqlite/SQLiteDatabaseHandler.java +++ b/src/main/java/world/bentobox/bentobox/database/sqlite/SQLiteDatabaseHandler.java @@ -205,9 +205,12 @@ public class SQLiteDatabaseHandler extends AbstractJSONDatabaseHandler { dataObject.getCanonicalName() + "` WHERE uniqueId = ?"; try (PreparedStatement preparedStatement = connection.prepareStatement(sb)) { - // UniqueId needs to be placed in quotes - preparedStatement.setString(1, "\"" + uniqueId + "\""); - preparedStatement.execute(); + // UniqueId must not be placed in quotes + preparedStatement.setString(1, uniqueId); + int result = preparedStatement.executeUpdate(); + if (result != 1) { + throw new SQLException("Delete did not affect any rows!"); + } } catch (Exception e) { plugin.logError("Could not delete object " + dataObject.getCanonicalName() + " " + uniqueId + " " + e.getMessage()); }