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

Commit b7e07a59 by Andreas Lubbe

ne: null now yields "IS NOT NULL" instead of "!= NULL"

1 parent bdd6251b
......@@ -650,7 +650,7 @@ module.exports = (function() {
result.push([_key, _value].join("="))
} else {
for (var logic in value) {
var logicResult = Utils.getWhereLogic(logic)
var logicResult = Utils.getWhereLogic(logic, hash[key][logic]);
if (logic === "IN" || logic === "NOT IN") {
var values = Array.isArray(where[i][ii]) ? where[i][ii] : [where[i][ii]]
_where[_where.length] = i + ' ' + logic + ' (' + values.map(function(){ return '?' }).join(',') + ')'
......
......@@ -180,7 +180,7 @@ var Utils = module.exports = {
}
else if (type === "object") {
Object.keys(where[i]).forEach(function(ii) {
logic = self.getWhereLogic(ii)
logic = self.getWhereLogic(ii, where[i][ii]);
switch(logic) {
case 'IN':
......@@ -282,7 +282,7 @@ var Utils = module.exports = {
return Utils._.compactLite([text.join(' AND ')].concat(whereArgs))
},
getWhereLogic: function(logic) {
getWhereLogic: function(logic, val) {
switch (logic) {
case 'join':
return 'JOIN'
......@@ -297,7 +297,8 @@ var Utils = module.exports = {
case 'eq':
return '='
case 'ne':
return '!='
if (val) return '!='
else return 'IS NOT'
case 'between':
case '..':
return 'BETWEEN'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!