@pi-r/mysql 0.10.2 → 0.11.0

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.
Files changed (2) hide show
  1. package/client/index.js +9 -11
  2. package/package.json +4 -4
package/client/index.js CHANGED
@@ -97,13 +97,16 @@ function setCredential(item) {
97
97
  }
98
98
  const config = this.getPoolConfig("mysql", password);
99
99
  if (config) {
100
- const { max, idle, queue_max, timeout } = config;
100
+ const { max, idle, idle_max, queue_max, timeout } = config;
101
101
  if (max > 0) {
102
102
  credential.connectionLimit ??= max;
103
103
  }
104
104
  if (idle >= 0) {
105
105
  credential.idleTimeout ??= idle;
106
106
  }
107
+ if (idle_max >= 0) {
108
+ credential.maxIdle ??= idle_max;
109
+ }
107
110
  if (queue_max >= 0) {
108
111
  credential.queueLimit ??= queue_max;
109
112
  }
@@ -173,16 +176,11 @@ async function executeBatchQuery(batch, options = '', outResult) {
173
176
  }
174
177
  catch (err) {
175
178
  let close;
176
- switch (err instanceof Error && err.code) {
177
- case 'ER_ACCESS_DENIED_ERROR':
178
- case 'ER_DBACCESS_DENIED_ERROR':
179
- case 'ER_SPECIFIC_ACCESS_DENIED_ERROR':
180
- case 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR':
181
- close = 1;
182
- break;
183
- default:
184
- close = pool.closeable;
185
- break;
179
+ if ((0, types_1.isErrorCode)(err, 'ER_ACCESS_DENIED_ERROR', 'ER_DBACCESS_DENIED_ERROR', 'ER_SPECIFIC_ACCESS_DENIED_ERROR', 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR')) {
180
+ close = 1;
181
+ }
182
+ else {
183
+ close = pool.closeable;
186
184
  }
187
185
  if (close) {
188
186
  await pool.detach(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mysql",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "MySQL client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
22
  "dependencies": {
23
- "@e-mc/db": "^0.12.5",
24
- "@e-mc/types": "^0.12.5",
25
- "mysql2": "^3.14.3"
23
+ "@e-mc/db": "^0.13.0",
24
+ "@e-mc/types": "^0.13.0",
25
+ "mysql2": "^3.15.2"
26
26
  }
27
27
  }