Avoid duplicate column restriction in where

This commit is contained in:
Tetsuo Seto 2017-05-12 17:07:35 -07:00
parent 5307f68364
commit 710cb0779f
1 changed files with 6 additions and 1 deletions

View File

@ -1159,7 +1159,12 @@ SQLConnector.prototype._buildWhere = function(model, where) {
}
}
}
whereStmts.push(stmt);
var columnRestricted = false;
whereStmts.forEach(function(stmt) {
if (columnRestricted) return;
columnRestricted = stmt.sql.indexOf(columnName) >= 0;
});
if (!columnRestricted) whereStmts.push(stmt);
}
var params = [];
var sqls = [];