Skip to content

Commit

Permalink
use mysql2 instead of mysql to support Mysql8
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-re committed Jul 19, 2020
1 parent 6c15b2c commit b840d3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"@types/pg": "^7.4.10",
"jest": "^26.0.1",
"log4js": "^6.2.1",
"mysql": "^2.15.0",
"mysql2": "^2.1.0",
"node-ssh-forward": "^0.6.3",
"pg": "^7.4.3",
"sqlint": "^0.9.2",
"sqlite3": "^4.2.0",
"vscode-languageclient": "^6.1.3",
"vscode-languageserver": "^6.1.1",
"vscode-languageserver-textdocument": "^1.0.1",
"yargs": "^12.0.1",
"sqlint": "^0.9.2"
"yargs": "^12.0.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module 'yargs'
declare module 'mysql2'
7 changes: 4 additions & 3 deletions packages/server/src/database_libs/MysqlClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as mysql from 'mysql'
import * as mysql from 'mysql2'
import * as mysqlType from 'mysql'
import { Settings } from '../SettingStore'
import AbstractClient, { RawField } from './AbstractClient'

export default class MysqlClient extends AbstractClient {
connection: mysql.Connection | null = null
connection: mysqlType.Connection | null = null

constructor(settings: Settings) {
super(settings)
Expand Down Expand Up @@ -47,7 +48,7 @@ export default class MysqlClient extends AbstractClient {
reject(new Error(err.message))
return
}
const tables = results.map((v: any) => v[`table_name`])
const tables = results.map((v: any) => v['table_name'] || v['TABLE_NAME'])
resolve(tables)
})
})
Expand Down

0 comments on commit b840d3d

Please sign in to comment.