Merge pull request #136 from sdrdis/patch-3

Fixed bug for IN on NOT IN - corrected
This commit is contained in:
Anatoliy Chakkaev 2012-10-23 14:54:02 -07:00
commit 799fe31b10
1 changed files with 4 additions and 0 deletions

View File

@ -238,6 +238,10 @@ MySQL.prototype.all = function all(model, filter, callback) {
} else if (conds[key].constructor.name === 'Object') {
var condType = Object.keys(conds[key])[0];
var sqlCond = keyEscaped;
if ((condType == 'inq' || condType == 'nin') && val.length == 0) {
cs.push(condType == 'inq' ? 0 : 1);
return true;
}
switch (condType) {
case 'gt':
sqlCond += ' > ';