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

Commit 0338f405 by Sohum Banerjea

fixes #1358

1 parent dc07afa3
......@@ -915,6 +915,8 @@ module.exports = (function() {
result = this.hashToWhereConditions(smth)
} else if (typeof smth === "string") {
result = smth
} else if (Buffer.isBuffer(smth)) {
result = this.escape(smth)
} else if (Array.isArray(smth)) {
var treatAsAnd = smth.reduce(function(treatAsAnd, arg) {
if (treatAsAnd) {
......
......@@ -180,7 +180,7 @@ var Utils = module.exports = {
_where[i].in = _where[i].in || []
_where[i].in.concat(where[i])
}
else if (type === "object") {
else if (Utils.isHash(where[i])) {
Object.keys(where[i]).forEach(function(ii) {
logic = self.getWhereLogic(ii, where[i][ii]);
......@@ -212,7 +212,7 @@ var Utils = module.exports = {
}
})
}
else if (type === "string" || type === "number" || type === "boolean") {
else if (type === "string" || type === "number" || type === "boolean" || Buffer.isBuffer(where[i])) {
_where[i].lazy = _where[i].lazy || {conditions: [], bindings: []}
if (type === "boolean") {
_where[i].lazy.conditions[_where[i].lazy.conditions.length] = '= ' + SqlString.escape(where[i], false, null, dialect) // sqlite is special
......@@ -321,7 +321,7 @@ var Utils = module.exports = {
}
},
isHash: function(obj) {
return Utils._.isObject(obj) && !Array.isArray(obj);
return Utils._.isObject(obj) && !Array.isArray(obj) && !Buffer.isBuffer(obj);
},
hasChanged: function(attrValue, value) {
//If attribute value is Date, check value as a date
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!