update config; support mysql 8.x

master
宇天 2020-11-24 21:11:45 +08:00
parent e2a5887778
commit 662769b244
6 changed files with 23 additions and 22 deletions

6
.gitignore vendored
View File

@ -1,9 +1,9 @@
.DS_Store
.AppleDouble
.LSOverride
Icon
/dist
/node_modules
package-lock.json
node_modules/
# Thumbnails
._*

View File

@ -1,10 +1,9 @@
/**
* mysql操作类
* @authors yutent (yutent@doui.cc)
* @date 2015-11-24 11:31:55
*
* @author yutent<yutent.io@gmail.com>
* @date 2020/11/24 20:04:20
*/
'use strict'
require('es.shim')
const mysql = require('mysql')
const Api = require('./lib/api')
@ -42,7 +41,7 @@ class Mysqli {
charset = charset || 'utf8mb4'
collate =
charset + (charset === 'utf8mb4' ? '_unicode_ci' : '_general_ci')
charset + (charset === 'utf8mb4' ? '_0900_ai_ci' : '_general_ci')
timezone = timezone || 'local'
supportBigNumbers = !!supportBigNumbers

View File

@ -1,8 +1,7 @@
/**
*
* @authors yutent (yutent@doui.cc)
* @date 2018-04-13 14:30:49
* @version $Id$
* @author yutent<yutent.io@gmail.com>
* @date 2020/11/24 20:04:39
*/
const { SqlErr, parser, fixtable } = require('./utils')

View File

@ -1,8 +1,7 @@
/**
*
* @authors yutent (yutent@doui.cc)
* @date 2017-12-14 14:01:03
* @version $Id$
* @author yutent<yutent.io@gmail.com>
* @date 2020/11/24 20:04:58
*/
const { SqlErr, parser, escape, fixtable } = require('./utils')
@ -406,7 +405,9 @@ class Method {
return this.connect().then(conn => {
const defer = Promise.defer()
let sql = `ALTER TABLE ${this.cache.table} ADD ${unique} INDEX \`${name}\` (${opt.field})`
let sql = `ALTER TABLE ${
this.cache.table
} ADD ${unique} INDEX \`${name}\` (${opt.field})`
conn.query(sql, (err, result) => {
conn.release()

View File

@ -1,9 +1,9 @@
/**
*
* @authors yutent (yutent@doui.cc)
* @date 2017-12-14 02:41:15
* @version $Id$
* @author yutent<yutent.io@gmail.com>
* @date 2020/11/24 20:07:37
*/
const { escape } = require('mysql')
function hideProperty(host, name, value) {
@ -275,7 +275,9 @@ 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.')

View File

@ -1,13 +1,13 @@
{
"name": "mysqli",
"version": "3.0.11",
"version": "3.0.12",
"description": "MySQL tool",
"main": "index.js",
"dependencies": {
"es.shim": "^1.1.2",
"es.shim": "^2.0.1",
"mysql": "^2.13.0"
},
"repository": "https://github.com/yutent/mysqli.git",
"repository": "https://github.com/bytedo/mysqli.git",
"author": "yutent",
"license": "MIT"
}