Merge pull request #19 from vectart/master

Prevent inserting undefined values
This commit is contained in:
Raymond Feng 2014-03-21 08:46:09 -07:00
commit f6a370921d
1 changed files with 7 additions and 3 deletions

View File

@ -215,9 +215,13 @@ MySQL.prototype.updateOrCreate = function (model, data, callback) {
} else {
v = data[key];
}
fieldsNames.push(k);
fieldValues.push(v);
if (!mysql.id(model, key)) combined.push(k + ' = ' + v);
if (v !== undefined) {
fieldsNames.push(k);
fieldValues.push(v);
if (!mysql.id(model, key)) {
combined.push(k + ' = ' + v);
}
}
}
});