dborm-mysql 2.2.4 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base/db.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Created by hzzhangdianpeng on 2016/12/2.
3
3
  */
4
4
 
5
- let mysql = require('mysql');
5
+ let mysql = require('mysql2');
6
6
  const co = require('co');
7
7
  let shortUuid = require('short-uuid');
8
8
  let moment = require('moment');
@@ -40,11 +40,12 @@ module.exports = (dbConfig, {log, noConvertDbCodes, dbCode, logExecuteTime, logg
40
40
  return new Promise(function (resolve, reject) {
41
41
  db.pool.getConnection(function (err, connection) {
42
42
  if (err) {
43
- if(err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT' || err.code === 'PROTOCOL_SEQUENCE_TIMEOUT'){
43
+ if(err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.code === 'PROTOCOL_SEQUENCE_TIMEOUT'){
44
44
  logger('mysql reconnect, reconnect time:', reconnectionTime++);
45
45
  db.getConnection().then(resolve, reject);
46
+ } else {
47
+ reject(err);
46
48
  }
47
- reject(err);
48
49
  } else {
49
50
  connection.connectionLogId = options.transId || shortUuid().new().slice(0, 6);
50
51
  reconnectionTime = 0;
package/index.d.ts CHANGED
@@ -25,7 +25,7 @@
25
25
  /*~ This declaration specifies that the function
26
26
  *~ is the exported object from the file
27
27
  */
28
- import mysql = require('mysql');
28
+ import mysql = require('mysql2');
29
29
 
30
30
  export = dbORM;
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dborm-mysql",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "a NodeJs ORM for mysql",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "co": "^4.6.0",
10
10
  "lodash": "^4.17.4",
11
11
  "moment": "^2.24.0",
12
- "mysql": "^2.14.1",
12
+ "mysql2": "3.16.1",
13
13
  "short-uuid": "^2.2.0",
14
14
  "util": "^0.10.3"
15
15
  },
@@ -33,4 +33,4 @@
33
33
  ],
34
34
  "author": "zhangdianp@163.com",
35
35
  "license": "ISC"
36
- }
36
+ }