不要怂,就是干,撸起袖子干!

Commit b1235d3b by Thomas Watson Steen

Fix bug in Utils.format that ignore falsy values.

Previously this would affect where clauses, e.g:
  User.findAll({ where: ['foo = ?', 0])
Would translate into:
  SELECT * FROM `Users`.`foo` = ?
Instead of:
  SELECT * FROM `Users`.`foo` = 0
1 parent d6608507
Showing with 1 additions and 4 deletions
......@@ -47,10 +47,7 @@ var Utils = module.exports = {
return connection.escape(s).replace(/\\"/g, '"')
},
format: function(arr) {
var query = arr[0]
, replacements = Utils._.compact(arr.map(function(obj) { return obj != query ? obj : null}))
return connection.format.apply(connection, [query, replacements])
return connection.format.apply(connection, [arr.shift(), arr])
},
isHash: function(obj) {
return Utils._.isObject(obj) && !Utils._.isArray(obj);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!