Skip to content

Commit

Permalink
Fix exception when storing Extension boolean values with MySQL
Browse files Browse the repository at this point in the history
Query was using reserved keyword 'stored' as a table alias

Changed it to use 'indb' as the alias

Affects issues:
- Fixed #3508
  • Loading branch information
AuroraLS3 committed Mar 9, 2024
1 parent 9c43287 commit 670ef2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ private List<Integer> selectUnfulfilledProviderIds() {
// 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);
}
Expand All @@ -178,13 +178,13 @@ private List<Integer> selectUnfulfilledTableIds() {
// 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ private List<Integer> selectUnfulfilledProviderIds() {
// 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);
}
Expand All @@ -163,13 +163,13 @@ private List<Integer> selectUnfulfilledTableIds() {
// 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);
}
Expand Down

0 comments on commit 670ef2a

Please sign in to comment.