优化一处由于js对象引用类型引起的混乱

master 2.0.1
宇天 2017-05-22 13:26:53 +08:00
parent c2d8e2bcea
commit 572f7580eb
3 changed files with 9 additions and 4 deletions

View File

@ -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 * new project

View File

@ -23,12 +23,13 @@ function parseWhere(arr){
it.join = it.join || 'AND' it.join = it.join || 'AND'
it.op = it.op || '=' it.op = it.op || '='
let fixVal = it.val
if(!/(^\(SELECT\s+.*\)$)|^`/.test(it.val) && !['IN', 'BETWEEN'].includes(it.op)){ 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)/, ' ') + ' ' where = ' WHERE ' + where.trim().replace(/^(AND|OR)/, ' ') + ' '

View File

@ -1,6 +1,6 @@
{ {
"name": "mysqli", "name": "mysqli",
"version": "2.0.0", "version": "2.0.1",
"description": "MySQL tool", "description": "MySQL tool",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {