From 06f8508a15085b7d4ddb564af07742b8b8ea9b32 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 14 Nov 2019 16:19:53 +0100 Subject: [PATCH] add error if pExecuteOnlyIfConditionExists is not a boolean --- process/Sql_lib/process.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 7f2e443ab6..6a9d14b5ca 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -283,6 +283,10 @@ SqlBuilder.ERROR_CONDITION_WRONG_FORMAT = function () return new Error(translate.text("SqlBuilder: The '#' in pCondition has to occur before the '?' and '?' has to occur 1 time, '#' has to occur 1 or 0 times.")); } +SqlBuilder.ERROR_NOT_BOOLEAN = function () +{ + return new Error(translate.text("pExecuteOnlyIfConditionExists has to be of type boolean. This parameter controls what happens if the condition is empty (select / delete all or nothing)")); +} /** * Builds the sql and uses SqlUtils.translateXXXWithQuotes to make a string out of it. @@ -1712,9 +1716,12 @@ SqlBuilder.prototype.tablePage = function(pStartIndex, pRowCount, pExecuteOnlyIf */ SqlBuilder.prototype._checkForUpdate = function(pExecuteOnlyIfConditionExists) { - if (pExecuteOnlyIfConditionExists == undefined) + if (pExecuteOnlyIfConditionExists === undefined) pExecuteOnlyIfConditionExists = true; + if (typeof pExecuteOnlyIfConditionExists !== "boolean") + + return !pExecuteOnlyIfConditionExists || this.hasCondition(); } -- GitLab