@pi-r/mariadb 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("mariadb", sessionKey);
152
+ const sortKeys = this.settingsOf("mariadb", 'cache', 'sort_keys') === true;
152
153
  const tasks = new Array(length);
153
154
  const clients = [];
154
155
  const pools = [];
@@ -240,11 +241,12 @@ async function executeBatchQuery(batch, options = '', outResult) {
240
241
  }
241
242
  item.transactionState = 1;
242
243
  const cacheValue = ignoreCache === undefined ? sessionKey : Array.isArray(ignoreCache) ? { sessionKey, exclusiveOf: ignoreCache } : { sessionKey, renewCache: ignoreCache === 0 };
243
- let queryString = '';
244
+ let queryString = '', cacheCredential;
244
245
  if (caching && ignoreCache !== true && !prepared && !streamRow) {
245
246
  queryString = Db.asString(query, true) + '_' + Db.asString(params, true);
247
+ cacheCredential = DbPool.sanitize(credential, sortKeys);
246
248
  if (ignoreCache !== 1) {
247
- const result = this.getQueryResult(source, DbPool.sanitize(credential), queryString, cacheValue);
249
+ const result = this.getQueryResult(source, cacheCredential, queryString, cacheValue);
248
250
  if (result) {
249
251
  if (parallel) {
250
252
  tasks[i] = Promise.resolve(result);
@@ -304,7 +306,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
304
306
  }
305
307
  else {
306
308
  this.add(item, 4);
307
- resolve(!error ? this.setQueryResult(source, DbPool.sanitize(credential), queryString, rows, cacheValue) : rows.length > 0 ? rows : null);
309
+ resolve(!error ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : rows.length > 0 ? rows : null);
308
310
  }
309
311
  }
310
312
  else {
@@ -316,7 +318,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
316
318
  resolve(row1);
317
319
  }
318
320
  else {
319
- resolve(!isOkPacket(row1) ? this.setQueryResult(source, DbPool.sanitize(credential), queryString, rows, cacheValue) : null);
321
+ resolve(!isOkPacket(row1) ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : null);
320
322
  }
321
323
  }
322
324
  else {
package/client/pool.js CHANGED
@@ -12,7 +12,7 @@ class MariaDBPool extends DbPool {
12
12
  }
13
13
  return super.asString(credential);
14
14
  }
15
- static sanitize(credential) {
15
+ static sanitize(credential, sort) {
16
16
  if (!this.canCache(credential)) {
17
17
  return;
18
18
  }
@@ -20,7 +20,7 @@ class MariaDBPool extends DbPool {
20
20
  return credential;
21
21
  }
22
22
  const ssl = credential.ssl;
23
- let result = super.sanitize(credential);
23
+ let result = super.sanitize(credential, sort);
24
24
  if (isObject(ssl)) {
25
25
  if (result === credential) {
26
26
  result = { ...credential };
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@pi-r/mariadb",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "MariaDB 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
- "mariadb": "^3.5.2"
20
+ "@e-mc/db": "^0.14.3",
21
+ "@e-mc/types": "^0.14.3",
22
+ "mariadb": "^3.5.3"
26
23
  }
27
24
  }