From 572f7580eb965c9098ed20cfb25d4b4a1cbc665b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 22 May 2017 13:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E5=A4=84=E7=94=B1?= =?UTF-8?q?=E4=BA=8Ejs=E5=AF=B9=E8=B1=A1=E5=BC=95=E7=94=A8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=BC=95=E8=B5=B7=E7=9A=84=E6=B7=B7=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- History.md | 6 +++++- index.js | 5 +++-- package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) 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": {