@pi-r/mysql 0.12.0 → 0.12.2

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/client/index.js CHANGED
@@ -149,6 +149,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
149
149
  outResult ||= new Array(length);
150
150
  }
151
151
  const caching = this.hasCache("mysql", sessionKey);
152
+ const sortKeys = this.settingsOf("mysql", 'cache', 'sort_keys') === true;
152
153
  const tasks = new Array(length);
153
154
  const clients = [];
154
155
  const pools = [];
@@ -251,11 +252,12 @@ async function executeBatchQuery(batch, options = '', outResult) {
251
252
  }
252
253
  item.transactionState = 1;
253
254
  const cacheValue = ignoreCache === undefined ? sessionKey : Array.isArray(ignoreCache) ? { sessionKey, exclusiveOf: ignoreCache } : { sessionKey, renewCache: ignoreCache === 0 };
254
- let queryString = '';
255
+ let queryString = '', cacheCredential;
255
256
  if (caching && ignoreCache !== true && !prepared && !streamRow) {
256
257
  queryString = Db.asString(query, true) + '_' + Db.asString(params, true);
258
+ cacheCredential = DbPool.sanitize(credential, sortKeys);
257
259
  if (ignoreCache !== 1) {
258
- const result = this.getQueryResult(source, DbPool.sanitize(credential), queryString, cacheValue);
260
+ const result = this.getQueryResult(source, cacheCredential, queryString, cacheValue);
259
261
  if (result) {
260
262
  if (parallel) {
261
263
  tasks[i] = Promise.resolve(result);
@@ -317,7 +319,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
317
319
  }
318
320
  else {
319
321
  this.add(item, 4);
320
- resolve(!error ? this.setQueryResult(source, DbPool.sanitize(credential), queryString, rows, cacheValue) : rows.length > 0 ? rows : null);
322
+ resolve(!error ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : rows.length > 0 ? rows : null);
321
323
  }
322
324
  });
323
325
  }
@@ -335,7 +337,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
335
337
  resolve(row1);
336
338
  }
337
339
  else {
338
- resolve(!isResultSetHeader(row1) ? this.setQueryResult(source, DbPool.sanitize(credential), queryString, rows, cacheValue) : null);
340
+ resolve(!isResultSetHeader(row1) ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : null);
339
341
  }
340
342
  }
341
343
  else {
package/client/pool.js CHANGED
@@ -13,7 +13,7 @@ class MySQLPool extends DbPool {
13
13
  }
14
14
  return super.asString(credential);
15
15
  }
16
- static sanitize(credential) {
16
+ static sanitize(credential, sort) {
17
17
  if (!this.canCache(credential)) {
18
18
  return;
19
19
  }
@@ -21,7 +21,7 @@ class MySQLPool extends DbPool {
21
21
  return credential;
22
22
  }
23
23
  const ssl = credential.ssl;
24
- let result = super.sanitize(credential);
24
+ let result = super.sanitize(credential, sort);
25
25
  if (isObject(ssl)) {
26
26
  if (result === credential) {
27
27
  result = { ...credential };
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@pi-r/mysql",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "MySQL client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
7
  "repository": {
11
8
  "type": "git",
12
9
  "url": "git+https://github.com/anpham6/pi-r.git",
@@ -20,8 +17,8 @@
20
17
  "license": "MIT",
21
18
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
19
  "dependencies": {
23
- "@e-mc/db": "^0.14.0",
24
- "@e-mc/types": "^0.14.0",
25
- "mysql2": "^3.22.3"
20
+ "@e-mc/db": "^0.14.3",
21
+ "@e-mc/types": "^0.14.3",
22
+ "mysql2": "^3.22.5"
26
23
  }
27
24
  }