parent
c2d8e2bcea
commit
572f7580eb
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
5
index.js
5
index.js
|
@ -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)/, ' ') + ' '
|
||||||
|
|
|
@ -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": {
|
||||||
|
|
Loading…
Reference in New Issue