From 670ef2aff31a59c8dfd1dde77de6c2aa491e0aff Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sat, 9 Mar 2024 10:51:53 +0200 Subject: [PATCH] Fix exception when storing Extension boolean values with MySQL Query was using reserved keyword 'stored' as a table alias Changed it to use 'indb' as the alias Affects issues: - Fixed #3508 --- .../StorePlayerBooleanResultTransaction.java | 20 +++++++++---------- .../StoreServerBooleanResultTransaction.java | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StorePlayerBooleanResultTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StorePlayerBooleanResultTransaction.java index 5074cddf5..070a794bf 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StorePlayerBooleanResultTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StorePlayerBooleanResultTransaction.java @@ -152,13 +152,13 @@ public class StorePlayerBooleanResultTransaction extends ThrowawayTransaction { // Need to select: // Provider IDs where condition of this provider is met @Language("SQL") String selectUnsatisfiedProviderIds = "SELECT unfulfilled.id " + - "FROM plan_extension_providers stored " + + "FROM plan_extension_providers indb " + "JOIN plan_extension_providers unfulfilled ON unfulfilled.condition_name=" + // This gives the unfulfilled condition, eg. if value is true not_condition is unfulfilled. - (value ? "CONCAT('not_', " : "") + "stored.provided_condition" + (value ? ")" : "") + - " AND stored.plugin_id=unfulfilled.plugin_id" + - " WHERE stored.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + - " AND stored.provided_condition IS NOT NULL"; + (value ? "CONCAT('not_', " : "") + "indb.provided_condition" + (value ? ")" : "") + + " AND indb.plugin_id=unfulfilled.plugin_id" + + " WHERE indb.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + + " AND indb.provided_condition IS NOT NULL"; return extractIds(selectUnsatisfiedProviderIds); } @@ -178,13 +178,13 @@ public class StorePlayerBooleanResultTransaction extends ThrowawayTransaction { // Need to select: // Provider IDs where condition of this provider is met @Language("SQL") String selectUnsatisfiedProviderIds = "SELECT unfulfilled.id " + - "FROM plan_extension_providers stored " + + "FROM plan_extension_providers indb " + "JOIN plan_extension_tables unfulfilled ON unfulfilled.condition_name=" + // This gives the unfulfilled condition, eg. if value is true not_condition is unfulfilled. - (value ? "CONCAT('not_', " : "") + "stored.provided_condition" + (value ? ")" : "") + - " AND stored.plugin_id=unfulfilled.plugin_id" + - " WHERE stored.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + - " AND stored.provided_condition IS NOT NULL"; + (value ? "CONCAT('not_', " : "") + "indb.provided_condition" + (value ? ")" : "") + + " AND indb.plugin_id=unfulfilled.plugin_id" + + " WHERE indb.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + + " AND indb.provided_condition IS NOT NULL"; return extractIds(selectUnsatisfiedProviderIds); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StoreServerBooleanResultTransaction.java b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StoreServerBooleanResultTransaction.java index 866d3fdd4..4f9cbcfef 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StoreServerBooleanResultTransaction.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/extension/implementation/storage/transactions/results/StoreServerBooleanResultTransaction.java @@ -131,13 +131,13 @@ public class StoreServerBooleanResultTransaction extends ThrowawayTransaction { // Need to select: // Provider IDs where condition of this provider is met @Language("SQL") String selectUnsatisfiedProviderIds = "SELECT unfulfilled.id " + - "FROM plan_extension_providers stored " + + "FROM plan_extension_providers indb " + "JOIN plan_extension_providers unfulfilled ON unfulfilled.condition_name=" + // This gives the unfulfilled condition, eg. if value is true not_condition is unfulfilled. - (value ? "CONCAT('not_', " : "") + "stored.provided_condition" + (value ? ")" : "") + - " AND stored.plugin_id=unfulfilled.plugin_id" + - " WHERE stored.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + - " AND stored.provided_condition IS NOT NULL"; + (value ? "CONCAT('not_', " : "") + "indb.provided_condition" + (value ? ")" : "") + + " AND indb.plugin_id=unfulfilled.plugin_id" + + " WHERE indb.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + + " AND indb.provided_condition IS NOT NULL"; return extractIds(selectUnsatisfiedProviderIds); } @@ -163,13 +163,13 @@ public class StoreServerBooleanResultTransaction extends ThrowawayTransaction { // Need to select: // Provider IDs where condition of this provider is met @Language("SQL") String selectUnsatisfiedProviderIds = "SELECT unfulfilled.id " + - "FROM plan_extension_providers stored " + + "FROM plan_extension_providers indb " + "JOIN plan_extension_tables unfulfilled ON unfulfilled.condition_name=" + // This gives the unfulfilled condition, eg. if value is true not_condition is unfulfilled. - (value ? "CONCAT('not_', " : "") + "stored.provided_condition" + (value ? ")" : "") + - " AND stored.plugin_id=unfulfilled.plugin_id" + - " WHERE stored.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + - " AND stored.provided_condition IS NOT NULL"; + (value ? "CONCAT('not_', " : "") + "indb.provided_condition" + (value ? ")" : "") + + " AND indb.plugin_id=unfulfilled.plugin_id" + + " WHERE indb.id=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID + + " AND indb.provided_condition IS NOT NULL"; return extractIds(selectUnsatisfiedProviderIds); }