Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SohumB committed Feb 8, 2014
1 parent dc07afa commit 0338f40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/dialects/abstract/query-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0338f40

Please sign in to comment.