diff --git a/History.md b/History.md index 1b2e094..3da61fc 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,10 @@ -1.0.0 / 2017-02-26 +2.0.1 / 2017-05-22 ================== + * 优化一处由于js对象引用类型引起的混乱 + +2.0.0 / 2017-02-26 +================== * new project diff --git a/index.js b/index.js index b951999..d7f0623 100644 --- a/index.js +++ b/index.js @@ -23,12 +23,13 @@ function parseWhere(arr){ it.join = it.join || 'AND' it.op = it.op || '=' + let fixVal = it.val if(!/(^\(SELECT\s+.*\)$)|^`/.test(it.val) && !['IN', 'BETWEEN'].includes(it.op)){ - it.val = mysql.escape(it.val) + fixVal = mysql.escape(it.val) } - where += `${it.join.toUpperCase()} ${it.key} ${it.op} ${it.val} ` + where += `${it.join.toUpperCase()} ${it.key} ${it.op} ${fixVal} ` } where = ' WHERE ' + where.trim().replace(/^(AND|OR)/, ' ') + ' ' diff --git a/package.json b/package.json index 5276f90..70f7bf5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mysqli", - "version": "2.0.0", + "version": "2.0.1", "description": "MySQL tool", "main": "index.js", "dependencies": {