master
宇天 2021-08-23 16:34:49 +08:00
parent 1a7dd811dd
commit c4b1968b10
2 changed files with 7 additions and 8 deletions

View File

@ -275,9 +275,7 @@ const parser = {
indexes.push(idx) indexes.push(idx)
} }
} }
sql += `\`${it.name}\` ${ sql += `\`${it.name}\` ${it.type} ${notnull} ${defaultVal} ${inc} ${autoUpdate},\n`
it.type
} ${notnull} ${defaultVal} ${inc} ${autoUpdate},\n`
} }
if (!primary) { if (!primary) {
throw new Error('Can not create table without primary key.') throw new Error('Can not create table without primary key.')
@ -294,14 +292,15 @@ const parser = {
class SqlErr { class SqlErr {
constructor(msg = '', sql = '') { constructor(msg = '', sql = '') {
var line = '-'.repeat(50)
this.message = msg this.message = msg
this.sql = sql this.sql = sql
hideProperty(this, 'stack', msg) hideProperty(this, 'stack', msg)
console.error( console.error(
'-'.repeat(50), line +
`[${new Date().format('Y/m/d_H:i:s')}][Last Query SQL]: ${sql}`, `\n[${new Date().format('Y/m/d_H:i:s')}][Last Query SQL]: ${sql}\nQuery ${msg}\n` +
`Query ${msg}`, line
'-'.repeat(50)
) )
} }

View File

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