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 .DS_Store
.AppleDouble .AppleDouble
.LSOverride .LSOverride
Icon
/dist package-lock.json
/node_modules node_modules/
# Thumbnails # Thumbnails
._* ._*

View File

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

View File

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

View File

@ -1,8 +1,7 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @author yutent<yutent.io@gmail.com>
* @date 2017-12-14 14:01:03 * @date 2020/11/24 20:04:58
* @version $Id$
*/ */
const { SqlErr, parser, escape, fixtable } = require('./utils') const { SqlErr, parser, escape, fixtable } = require('./utils')
@ -406,7 +405,9 @@ class Method {
return this.connect().then(conn => { return this.connect().then(conn => {
const defer = Promise.defer() 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.query(sql, (err, result) => {
conn.release() conn.release()

View File

@ -1,9 +1,9 @@
/** /**
* *
* @authors yutent (yutent@doui.cc) * @author yutent<yutent.io@gmail.com>
* @date 2017-12-14 02:41:15 * @date 2020/11/24 20:07:37
* @version $Id$
*/ */
const { escape } = require('mysql') const { escape } = require('mysql')
function hideProperty(host, name, value) { function hideProperty(host, name, value) {
@ -275,7 +275,9 @@ const parser = {
indexes.push(idx) 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) { if (!primary) {
throw new Error('Can not create table without primary key.') throw new Error('Can not create table without primary key.')

View File

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