From 87e0c1ad38982217f7823533af63289bdf8cee22 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 28 May 2019 16:06:30 +0200 Subject: [PATCH] better error message --- process/Sql_lib/process.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 0dfe954198..38ded284be 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -390,12 +390,28 @@ SqlCondition.prototype._prepare = function(field, value, cond, fieldType) { if (typeof field === 'string') { - alias = field; + var pointPos = field.indexOf("."); + + if (pointPos > 0 && pointPos < field.length-1) + { + alias = field; + } + else + { + throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field])); + } } else { - alias = field[2] + "." + field[1]; - field = field[0] + "." + field[1]; + if (field.length == 3) + { + alias = field[2] + "." + field[1]; + field = field[0] + "." + field[1]; + } + else + { + throw new Error(translate.withArguments("${SQL_LIB_FIELD_WRONG_FORMAT} field: %0", [field.toSource()])); + } } var type; -- GitLab