Skip to content
Snippets Groups Projects
Commit 28d43a38 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Sql_lib: SqlBuilder accepts conditions constants like: SqlBuilder.EQUAL (the whole function)

parent 55a86a6d
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ import("system.db");
import("system.result");
import("Sql_lib");
var cond = newWhereIfSet("ACTIVITYLINK.ACTIVITY_ID", "$param.ActivityId_param");
var cond = newWhereIfSet("ACTIVITYLINK.ACTIVITY_ID", "$param.ActivityId_param", SqlBuilder.EQUAL);
//TODO: use a preparedCondition (.build instead of .toString) when available #1030812 #1034026
result.string(cond.toString());
\ No newline at end of file
......@@ -1445,6 +1445,8 @@ SqlBuilder.prototype._addWhere = function(pFieldOrCond, pValue, pMandatory, pCon
{
//In a special case, pCondition can be a function. It will be called with the alias as argument and
//must return an array of the condition string and (optionally) the required sql field type.
//alternatively the function may return a string only to make the usage more bulletproof and convenient, so both SqlBuilder.EQUAL()
//and SqlBuilder.EQUAL work equally
if (pCondition && typeof pCondition === "function")
{
var resCond = pCondition(this.alias);
......@@ -1453,6 +1455,10 @@ SqlBuilder.prototype._addWhere = function(pFieldOrCond, pValue, pMandatory, pCon
pCondition = resCond[0];
pFieldType = pFieldType || resCond[1];
}
else if(typeof(resCond) == "string")
{
pCondition = resCond;
}
}
if (pCondition && !SqlUtils.checkConditionFormat(pCondition))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment