Skip to content

Commit

Permalink
Add checking for undefined in buildWhere
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Apr 22, 2013
1 parent 04d7663 commit 51c4ee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ MySQL.prototype.all = function all(model, filter, callback) {
Object.keys(conds).forEach(function (key) {
var keyEscaped = '`' + key.replace(/\./g, '`.`') + '`'
var val = self.toDatabase(props[key], conds[key]);
if (conds[key] === null) {
if (conds[key] === null || conds[key] === undefined) {
cs.push(keyEscaped + ' IS NULL');
} else if (conds[key].constructor.name === 'Object') {
} else if (conds[key] && conds[key].constructor.name === 'Object') {
var condType = Object.keys(conds[key])[0];
var sqlCond = keyEscaped;
if ((condType == 'inq' || condType == 'nin') && val.length == 0) {
Expand Down

0 comments on commit 51c4ee8

Please sign in to comment.