Don't add a WHERE if there are no constraints

This commit is contained in:
Henri Bergius 2012-03-06 14:08:27 +01:00
parent c33bc70756
commit cdc7ae6c82
1 changed files with 3 additions and 0 deletions

View File

@ -241,6 +241,9 @@ MySQL.prototype.all = function all(model, filter, callback) {
cs.push(keyEscaped + ' = ' + val);
}
});
if (cs.length === 0) {
return '';
}
return 'WHERE ' + cs.join(' AND ');
}