@pi-r/mysql 0.12.4 → 0.13.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 +5 -3
  2. package/package.json +4 -4
package/client/index.js CHANGED
@@ -110,6 +110,7 @@ function setCredential(item) {
110
110
  credential.connectTimeout ??= timeout;
111
111
  }
112
112
  }
113
+ credential.resetOnRelease ??= true;
113
114
  const poolKey = DbPool.asString(credential);
114
115
  if ((pool = POOL_STATE[poolKey]) && !pool.closed) {
115
116
  pool.add(item);
@@ -128,9 +129,9 @@ async function executeBatchQuery(batch, options = '', outResult) {
128
129
  if (length === 0) {
129
130
  return [];
130
131
  }
131
- let parallel, connectOnce, errorQuery, sessionKey, outCacheMiss;
132
+ let parallel, connectOnce, errorQuery, errorAsEmpty, sessionKey, outCacheMiss;
132
133
  if (isPlainObject(options)) {
133
- ({ parallel, connectOnce, errorQuery, sessionKey, outCacheMiss } = options);
134
+ ({ parallel, connectOnce, errorQuery, errorAsEmpty, sessionKey, outCacheMiss } = options);
134
135
  }
135
136
  else {
136
137
  if (typeof options === 'string') {
@@ -254,7 +255,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
254
255
  const cacheValue = ignoreCache === undefined ? sessionKey : Array.isArray(ignoreCache) ? { sessionKey, exclusiveOf: ignoreCache } : { sessionKey, renewCache: ignoreCache === 0 };
255
256
  let queryString = '', cacheCredential;
256
257
  if (caching && ignoreCache !== true && !prepared && !streamRow) {
257
- queryString = Db.asString(query, true) + '_' + Db.asString(params, true);
258
+ queryString = Db.keyForResult(query, params);
258
259
  cacheCredential = DbPool.sanitize(credential, sortKeys);
259
260
  if (ignoreCache !== 1) {
260
261
  const result = this.getQueryResult(source, cacheCredential, queryString, cacheValue);
@@ -366,6 +367,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
366
367
  }
367
368
  return this.processRows(batch, tasks, {
368
369
  parallel,
370
+ errorAsEmpty,
369
371
  disconnect: () => {
370
372
  for (const item of clients) {
371
373
  void item.end(err => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mysql",
3
- "version": "0.12.4",
3
+ "version": "0.13.0",
4
4
  "description": "MySQL client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "license": "MIT",
18
18
  "homepage": "https://github.com/anpham6/pi-r#readme",
19
19
  "dependencies": {
20
- "@e-mc/db": "^0.14.5",
21
- "@e-mc/types": "^0.14.5",
22
- "mysql2": "^3.23.2"
20
+ "@e-mc/db": "^0.14.6",
21
+ "@e-mc/types": "^0.14.6",
22
+ "mysql2": "^3.24.2"
23
23
  }
24
24
  }