From c4b1968b10d8ad34d7a3d7b4219be298f60a1ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 23 Aug 2021 16:34:49 +0800 Subject: [PATCH] optimize --- lib/utils.js | 13 ++++++------- package.json | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 9725121..13a217a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -275,9 +275,7 @@ const parser = { indexes.push(idx) } } - sql += `\`${it.name}\` ${ - it.type - } ${notnull} ${defaultVal} ${inc} ${autoUpdate},\n` + sql += `\`${it.name}\` ${it.type} ${notnull} ${defaultVal} ${inc} ${autoUpdate},\n` } if (!primary) { throw new Error('Can not create table without primary key.') @@ -294,14 +292,15 @@ const parser = { class SqlErr { constructor(msg = '', sql = '') { + var line = '-'.repeat(50) + this.message = msg this.sql = sql hideProperty(this, 'stack', msg) console.error( - '-'.repeat(50), - `[${new Date().format('Y/m/d_H:i:s')}][Last Query SQL]: ${sql}`, - `Query ${msg}`, - '-'.repeat(50) + line + + `\n[${new Date().format('Y/m/d_H:i:s')}][Last Query SQL]: ${sql}\nQuery ${msg}\n` + + line ) } diff --git a/package.json b/package.json index f24c963..bef336f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mysqli", - "version": "3.1.2", + "version": "3.1.3", "description": "MySQL tool", "main": "index.js", "dependencies": {