@pi-r/oracle 0.12.1 → 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 +6 -4
- package/client/pool.js +2 -2
- package/package.json +3 -6
package/client/index.js
CHANGED
|
@@ -199,6 +199,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
199
199
|
outResult ||= new Array(length);
|
|
200
200
|
}
|
|
201
201
|
const caching = this.hasCache("oracle", sessionKey);
|
|
202
|
+
const sortKeys = this.settingsOf("oracle", 'cache', 'sort_keys') === true;
|
|
202
203
|
const tasks = new Array(length);
|
|
203
204
|
const clients = [];
|
|
204
205
|
let oraclePool, oracleClient, oracleCredential, onceCredential = connectOnce ? batch[0].credential : undefined;
|
|
@@ -269,11 +270,12 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
269
270
|
item.transactionState = 1;
|
|
270
271
|
const streamRow = typeof item.streamRow === 'string' ? this.hasCoerce("oracle", 'options', credential) && asFunction(item.streamRow) : item.streamRow;
|
|
271
272
|
const cacheValue = ignoreCache === undefined ? sessionKey : Array.isArray(ignoreCache) ? { sessionKey, exclusiveOf: ignoreCache } : { sessionKey, renewCache: ignoreCache === 0 };
|
|
272
|
-
let queryString = '';
|
|
273
|
+
let queryString = '', cacheCredential;
|
|
273
274
|
if (caching && ignoreCache !== true && !streamRow) {
|
|
274
275
|
queryString = Db.asString(query, true) + '_' + Db.asString(params, true) + Db.asString(clientOptions, true);
|
|
276
|
+
cacheCredential = DbPool.sanitize(credential, sortKeys);
|
|
275
277
|
if (ignoreCache !== 1) {
|
|
276
|
-
const result = this.getQueryResult(source,
|
|
278
|
+
const result = this.getQueryResult(source, cacheCredential, queryString, cacheValue);
|
|
277
279
|
if (result) {
|
|
278
280
|
if (parallel) {
|
|
279
281
|
tasks[i] = Promise.resolve(result);
|
|
@@ -333,7 +335,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
333
335
|
}
|
|
334
336
|
else {
|
|
335
337
|
this.add(item, 4);
|
|
336
|
-
resolve(!error ? this.setQueryResult(source,
|
|
338
|
+
resolve(!error ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : rows);
|
|
337
339
|
}
|
|
338
340
|
})
|
|
339
341
|
.on('end', () => stream.destroy());
|
|
@@ -341,7 +343,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
|
|
|
341
343
|
else {
|
|
342
344
|
const { rows } = await client.execute(query, params || [], executeOptions);
|
|
343
345
|
this.add(item, 4);
|
|
344
|
-
resolve(rows ? this.setQueryResult(source,
|
|
346
|
+
resolve(rows ? this.setQueryResult(source, cacheCredential, queryString, rows, cacheValue) : null);
|
|
345
347
|
}
|
|
346
348
|
}
|
|
347
349
|
catch (err) {
|
package/client/pool.js
CHANGED
|
@@ -11,14 +11,14 @@ class OraclePool extends DbPool {
|
|
|
11
11
|
}
|
|
12
12
|
return super.asString(credential);
|
|
13
13
|
}
|
|
14
|
-
static sanitize(credential) {
|
|
14
|
+
static sanitize(credential, sort) {
|
|
15
15
|
if (!this.canCache(credential)) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
if (!POOL_ACTIVE.has(credential) || credential.uuidKey) {
|
|
19
19
|
return credential;
|
|
20
20
|
}
|
|
21
|
-
return super.sanitize(credential);
|
|
21
|
+
return super.sanitize(credential, sort);
|
|
22
22
|
}
|
|
23
23
|
get closeable() {
|
|
24
24
|
return super.closeable || this.client.status === 6001;
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/oracle",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "Oracle 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.
|
|
24
|
-
"@e-mc/types": "^0.14.
|
|
20
|
+
"@e-mc/db": "^0.14.3",
|
|
21
|
+
"@e-mc/types": "^0.14.3",
|
|
25
22
|
"oracledb": "^6.10.0"
|
|
26
23
|
}
|
|
27
24
|
}
|