From 496b3cbde942acf13d507b0eef3c693d04a0e3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 23 Sep 2019 16:17:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E6=B3=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- History.md | 3 ++- lib/api.js | 2 +- lib/method.js | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index c7976b1..5c3c715 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,5 @@ -# 3.0.9 / 2019-09-23 +# 3.0.10 / 2019-09-23 +* 优化数据库/表的删除判断; * 优化创建数据库/表时的默认配置顶; * 优化字段的默认值0的判断 diff --git a/lib/api.js b/lib/api.js index 10b6285..1c24f04 100644 --- a/lib/api.js +++ b/lib/api.js @@ -79,7 +79,7 @@ class Api { let defer = Promise.defer() this.connect().then(conn => { - conn.query(`DROP DATABASE ${db || this.db}`, (err, result) => { + conn.query(`DROP DATABASE IF EXISTS \`${db || this.db}\``, err => { conn.release() if (err) { return defer.reject(new SqlErr(`Drop database ${err}`)) diff --git a/lib/method.js b/lib/method.js index a8fd1bd..b3c9948 100644 --- a/lib/method.js +++ b/lib/method.js @@ -302,7 +302,7 @@ class Method { } drop() { - let sql = `DROP TABLE ${this.cache.table} ` + let sql = `DROP TABLE IF EXISTS \`${this.cache.table}\` ` return this.connect().then(conn => { const defer = Promise.defer() diff --git a/package.json b/package.json index 4223421..ceb43f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mysqli", - "version": "3.0.9", + "version": "3.0.10", "description": "MySQL tool", "main": "index.js", "dependencies": {