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

Commit 3f20fb5a by terraflubb

Process values going into WHERE clauses in MySQL

1 parent 026efd4b
Showing with 3 additions and 5 deletions
......@@ -432,19 +432,17 @@ module.exports = (function() {
if (Array.isArray(value)) {
// is value an array?
if (value.length === 0) { value = [null] }
_value = "(" + value.map(function(subValue) {
return Utils.escape(subValue);
}).join(',') + ")"
_value = "(" + value.map(processAndEscapeValue).join(',') + ")"
result.push([_key, _value].join(" IN "))
} else if ((value) && (typeof value == 'object')) {
} else if ((value) && (typeof value == 'object') && !(value instanceof Date)) {
// is value an object?
//using as sentinel for join column => value
_value = value.join.split('.').map(function(col){ return QueryGenerator.addQuotes(col) }).join(".")
result.push([_key, _value].join("="))
} else {
_value = Utils.escape(value)
_value = processAndEscapeValue(value)
result.push((_value == 'NULL') ? _key + " IS NULL" : [_key, _value].join("="))
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!