diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 1a55a386f9d48a5ea2e61246bc900eae1d121fde..740c601d92371391ddc7de891883d3b594d94677 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -956,15 +956,17 @@ SqlBuilder.begin = function () /** * Builds the sql and uses SqlUtils.translateXXXWithQuotes to make a string out of it. + * @param {String} [pDefaultConditionIfNone=""] the default condition string to use if the SqlBuilder contains no condition. In most cases you won't need this + * @param {Boolean} [pForceAsStatement=false] forces the use of SqlUtils.translateStatementWithQuotes even if it's no full statement. This is needed for example if you do not want brakets around the generated statement * @return {String} the sql as string */ -SqlBuilder.prototype.toString = function(pDefaultConditionIfNone) +SqlBuilder.prototype.toString = function(pDefaultConditionIfNone, pForceAsStatement) { var built = this.build(pDefaultConditionIfNone) if (built[0] !== "") { - if (!this.isFullSelect() && (this.hasCondition() || pDefaultConditionIfNone)) + if (!pForceAsStatement && !this.isFullSelect() && (this.hasCondition() || pDefaultConditionIfNone)) return SqlUtils.translateConditionWithQuotes(built, this.alias); else return SqlUtils.translateStatementWithQuotes(built, this.alias);