diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index d4d8afdaa40296cadc2c172ef2e077dc8575e066..52a7aac39ba045f833b59deb773dc19ea945c46e 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -1054,7 +1054,7 @@ SqlBuilder.prototype.tableName = function (pTable) */ SqlBuilder.prototype.from = function(pTable, pTableAlias) { - this._from = SqlBuilder._getStatement(pTable, "from", pTableAlias, false, (pTableAlias ? false : true)); + this._from = SqlBuilder._getStatement(pTable, "", pTableAlias, false, (pTableAlias ? false : true)); if (typeof(pTable) === "string") this._tableName = pTable; return this; @@ -2193,10 +2193,7 @@ SqlBuilder.prototype.whereWasCalled = function() { */ SqlBuilder.prototype.isFullSelect = function() { - if (!this._select || !this._from) - return false; - - return true; + return !(!this._select || !this._from); } /** @@ -2375,9 +2372,14 @@ SqlBuilder.prototype.buildCondition = function() SqlBuilder.prototype.build = function(pDefaultConditionIfNone) { var wherePrefix = ""; + var fromObj = this._from; if (this.isFullSelect()) { + fromObj = { + sqlStorage: "from " + this._from.sqlStorage, + preparedValues: this._from.preparedValues + }; if (this._where.sqlStorage) wherePrefix = "where "; } @@ -2390,11 +2392,11 @@ SqlBuilder.prototype.build = function(pDefaultConditionIfNone) var whereObj = { sqlStorage : wherePrefix + whereSql, preparedValues : this._where.preparedValues - } + }; var allParts = [ this._select, - this._from, + fromObj ].concat(this._joins).concat([ whereObj, this._groupBy,