diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 608c0c3bca2dfc631171b8c39aa27ad10febb2ab..52637d33d0a67011a602f0f47a408c52eef7ee93 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -790,18 +790,8 @@ function SqlBuilder (pAlias) this._subselectAlias = null; - this._where = { - preparedValues: [], - _sqlStorage: "", - - // save, if the last condition was an OR. For better bracket-placement - _lastWasOr: false, - // also for better bracket-placement - _previouslyOnlyOr: false, - - // where has always to be called first for a better semantic - _whereWasCalled: false - } + this._where = {}; + this._initWhere(); } /** @@ -1995,10 +1985,22 @@ SqlBuilder.prototype.isFullSelect = function() * @return {SqlBuilder} current SqlBuilder object */ SqlBuilder.prototype.clearWhere = function() +{ + this._initWhere(); + return this; +} + +/** + * function that initializes the properties of the ._where object, this is used in the + * constructor and .clearWhere + */ +SqlBuilder.prototype._initWhere = function () { this._where._sqlStorage = ""; this._where.preparedValues = []; - return this; + this._where._lastWasOr = false; // save, if the last condition was an OR. For better bracket-placement + this._where._previouslyOnlyOr = false; // also for better bracket-placement + this._where._whereWasCalled = false; // where has always to be called first for a better semantic } /**