oracledb 6.9.0 → 6.10.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.
- package/README.md +2 -2
- package/build/Release/oracledb-6.10.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.10.0-darwin-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.10.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.10.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.10.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.10.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.10.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.10.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.10.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.10.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.10.0-win32-x64.node-buildinfo.txt +1 -0
- package/lib/aqDeqOptions.js +18 -1
- package/lib/aqQueue.js +10 -6
- package/lib/connection.js +6 -2
- package/lib/dbObject.js +25 -4
- package/lib/errors.js +14 -4
- package/lib/impl/aqDeqOptions.js +10 -1
- package/lib/impl/datahandlers/buffer.js +49 -0
- package/lib/impl/datahandlers/oson.js +7 -2
- package/lib/impl/sodaDocument.js +5 -14
- package/lib/oracledb.js +23 -14
- package/lib/pool.js +187 -146
- package/lib/poolStatistics.js +1 -1
- package/lib/sodaCollection.js +12 -8
- package/lib/sodaDatabase.js +35 -8
- package/lib/sodaDocument.js +24 -6
- package/lib/sodaOperation.js +7 -6
- package/lib/thin/aq.js +475 -0
- package/lib/thin/connection.js +54 -4
- package/lib/thin/protocol/capabilities.js +3 -1
- package/lib/thin/protocol/constants.js +61 -0
- package/lib/thin/protocol/encryptDecrypt.js +2 -2
- package/lib/thin/protocol/messages/aqArray.js +238 -0
- package/lib/thin/protocol/messages/aqBase.js +305 -0
- package/lib/thin/protocol/messages/aqDeq.js +164 -0
- package/lib/thin/protocol/messages/aqEnq.js +135 -0
- package/lib/thin/protocol/messages/auth.js +12 -27
- package/lib/thin/protocol/messages/withData.js +3 -3
- package/lib/thin/protocol/packet.js +6 -5
- package/lib/thin/sqlnet/networkSession.js +1 -1
- package/lib/types.js +6 -6
- package/lib/util.js +0 -13
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/plugins/configProviders/azure/index.js +3 -0
- package/build/Release/oracledb-6.9.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/sodaOperation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2018,
|
|
1
|
+
// Copyright (c) 2018, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -34,11 +34,12 @@ const settings = require('./settings.js');
|
|
|
34
34
|
|
|
35
35
|
class SodaOperation {
|
|
36
36
|
|
|
37
|
-
constructor() {
|
|
37
|
+
constructor(sodaDb) {
|
|
38
38
|
this._options = {
|
|
39
39
|
autoCommit: settings.autoCommit,
|
|
40
40
|
fetchArraySize: settings.fetchArraySize
|
|
41
41
|
};
|
|
42
|
+
this._sodaDb = sodaDb;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
//---------------------------------------------------------------------------
|
|
@@ -118,7 +119,7 @@ class SodaOperation {
|
|
|
118
119
|
//---------------------------------------------------------------------------
|
|
119
120
|
async replaceOne(content) {
|
|
120
121
|
errors.assertArgCount(arguments, 1, 1);
|
|
121
|
-
content =
|
|
122
|
+
content = this._sodaDb._verifySodaDoc(content);
|
|
122
123
|
return await this._impl.replaceOne(this._options, content);
|
|
123
124
|
}
|
|
124
125
|
|
|
@@ -130,7 +131,7 @@ class SodaOperation {
|
|
|
130
131
|
//---------------------------------------------------------------------------
|
|
131
132
|
async replaceOneAndGet(content) {
|
|
132
133
|
errors.assertArgCount(arguments, 1, 1);
|
|
133
|
-
content =
|
|
134
|
+
content = this._sodaDb._verifySodaDoc(content);
|
|
134
135
|
const docImpl = await this._impl.replaceOneAndGet(this._options, content);
|
|
135
136
|
if (docImpl) {
|
|
136
137
|
const doc = new SodaDocument();
|
|
@@ -200,7 +201,7 @@ class SodaOperation {
|
|
|
200
201
|
// limit property - a non-terminal function and can chain further
|
|
201
202
|
limit(n) {
|
|
202
203
|
errors.assertArgCount(arguments, 1, 1);
|
|
203
|
-
errors.assertParamValue(
|
|
204
|
+
errors.assertParamValue(Number.isInteger(n) && n > 0, 1);
|
|
204
205
|
this._options.limit = n;
|
|
205
206
|
return this;
|
|
206
207
|
}
|
|
@@ -208,7 +209,7 @@ class SodaOperation {
|
|
|
208
209
|
// skip property - a non-terminal function and can chain further
|
|
209
210
|
skip(n) {
|
|
210
211
|
errors.assertArgCount(arguments, 1, 1);
|
|
211
|
-
errors.assertParamValue(
|
|
212
|
+
errors.assertParamValue(Number.isInteger(n) && n >= 0, 1);
|
|
212
213
|
this._options.skip = n;
|
|
213
214
|
return this;
|
|
214
215
|
}
|
package/lib/thin/aq.js
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
// Copyright (c) 2025, Oracle and/or its affiliates.
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// This software is dual-licensed to you under the Universal Permissive License
|
|
6
|
+
// (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
|
7
|
+
// 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
|
8
|
+
// either license.
|
|
9
|
+
//
|
|
10
|
+
// If you elect to accept the software under the Apache License, Version 2.0,
|
|
11
|
+
// the following applies:
|
|
12
|
+
//
|
|
13
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
// you may not use this file except in compliance with the License.
|
|
15
|
+
// You may obtain a copy of the License at
|
|
16
|
+
//
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
//
|
|
19
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
// See the License for the specific language governing permissions and
|
|
23
|
+
// limitations under the License.
|
|
24
|
+
//
|
|
25
|
+
//-----------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
const AqEnqMessage = require("./protocol/messages/aqEnq.js");
|
|
30
|
+
const AqDeqMessage = require("./protocol/messages/aqDeq.js");
|
|
31
|
+
const AqArrayMessage = require("./protocol/messages/aqArray.js");
|
|
32
|
+
const constants = require("./protocol/constants.js");
|
|
33
|
+
const errors = require("../errors.js");
|
|
34
|
+
const types = require("../types.js");
|
|
35
|
+
const { AQ_VISIBILITY_IMMEDIATE } = require("../constants.js");
|
|
36
|
+
|
|
37
|
+
class ThinQueueImpl {
|
|
38
|
+
|
|
39
|
+
constructor(connImpl, name, payloadTypeClass, payloadType) {
|
|
40
|
+
this._connImpl = connImpl;
|
|
41
|
+
this.name = name;
|
|
42
|
+
this.payloadTypeClass = payloadTypeClass;
|
|
43
|
+
this.isJson = payloadType === types.DB_TYPE_JSON;
|
|
44
|
+
this.payloadType = payloadType;
|
|
45
|
+
this.deqOptions = new ThinDeqOptionsImpl();
|
|
46
|
+
this.enqOptions = new ThinEnqOptionsImpl();
|
|
47
|
+
if (this.isJson) {
|
|
48
|
+
this.payloadToid = Buffer.alloc(16, 0);
|
|
49
|
+
this.payloadToid[15] = 0x47;
|
|
50
|
+
} else if (this.payloadTypeClass) {
|
|
51
|
+
// Assuming oid is Buffer
|
|
52
|
+
this.payloadToid = this.payloadTypeClass._objType.oid;
|
|
53
|
+
} else {
|
|
54
|
+
this.payloadToid = Buffer.alloc(16, 0);
|
|
55
|
+
this.payloadToid[15] = 0x17;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//---------------------------------------------------------------------------
|
|
60
|
+
// _createArrayDeqMessage()
|
|
61
|
+
//
|
|
62
|
+
// Creates an array dequeue message for dequeuing multiple messages.
|
|
63
|
+
//---------------------------------------------------------------------------
|
|
64
|
+
_createArrayDeqMessage(numIters) {
|
|
65
|
+
const message = new AqArrayMessage(this._connImpl);
|
|
66
|
+
message.numIters = numIters;
|
|
67
|
+
message.propsImpls = Array.from({length: numIters},
|
|
68
|
+
() => new ThinMsgPropsImpl());
|
|
69
|
+
message.queueImpl = this;
|
|
70
|
+
message.deqOptionsImpl = this.deqOptions;
|
|
71
|
+
message.operation = constants.TNS_AQ_ARRAY_DEQ;
|
|
72
|
+
return message;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//---------------------------------------------------------------------------
|
|
76
|
+
// _createArrayEnqMessage()
|
|
77
|
+
//
|
|
78
|
+
// Creates an array enqueue message for enqueuing multiple messages.
|
|
79
|
+
//---------------------------------------------------------------------------
|
|
80
|
+
_createArrayEnqMessage(propsImpls) {
|
|
81
|
+
const message = new AqArrayMessage(this._connImpl);
|
|
82
|
+
message.queueImpl = this;
|
|
83
|
+
message.enqOptionsImpl = this.enqOptions;
|
|
84
|
+
message.propsImpls = propsImpls;
|
|
85
|
+
message.operation = constants.TNS_AQ_ARRAY_ENQ;
|
|
86
|
+
message.numIters = propsImpls.length;
|
|
87
|
+
return message;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//---------------------------------------------------------------------------
|
|
91
|
+
// _createDeqMessage()
|
|
92
|
+
//
|
|
93
|
+
// Creates a dequeue message for dequeuing a single message.
|
|
94
|
+
//---------------------------------------------------------------------------
|
|
95
|
+
_createDeqMessage() {
|
|
96
|
+
const propsImpl = new ThinMsgPropsImpl();
|
|
97
|
+
const message = new AqDeqMessage(this._connImpl);
|
|
98
|
+
message.queueImpl = this;
|
|
99
|
+
message.deqOptionsImpl = this.deqOptions;
|
|
100
|
+
message.propsImpl = propsImpl;
|
|
101
|
+
return message;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//---------------------------------------------------------------------------
|
|
105
|
+
// _createEnqMessage()
|
|
106
|
+
//
|
|
107
|
+
// Creates an enqueue message for enqueuing a single message.
|
|
108
|
+
//---------------------------------------------------------------------------
|
|
109
|
+
_createEnqMessage(propsImpl) {
|
|
110
|
+
const message = new AqEnqMessage(this._connImpl);
|
|
111
|
+
message.queueImpl = this;
|
|
112
|
+
message.enqOptionsImpl = this.enqOptions;
|
|
113
|
+
message.propsImpl = propsImpl;
|
|
114
|
+
return message;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//---------------------------------------------------------------------------
|
|
118
|
+
// deq()
|
|
119
|
+
//
|
|
120
|
+
// Dequeues messages from the queue, either one or many based on the max
|
|
121
|
+
// number of messages requested.
|
|
122
|
+
//---------------------------------------------------------------------------
|
|
123
|
+
async deq(maxNumMessages) {
|
|
124
|
+
let results;
|
|
125
|
+
if (maxNumMessages > 1) {
|
|
126
|
+
results = await this.deqMany(maxNumMessages);
|
|
127
|
+
} else if (maxNumMessages == 1) {
|
|
128
|
+
results = await this.deqOne();
|
|
129
|
+
} else {
|
|
130
|
+
errors.throwErr(errors.ERR_INVALID_MAX_MESSAGES);
|
|
131
|
+
}
|
|
132
|
+
return results;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//---------------------------------------------------------------------------
|
|
136
|
+
// deqMany()
|
|
137
|
+
//
|
|
138
|
+
// Dequeues multiple messages from the queue.
|
|
139
|
+
//---------------------------------------------------------------------------
|
|
140
|
+
async deqMany(maxNumMessages) {
|
|
141
|
+
if (this.enqOptions.visibility === AQ_VISIBILITY_IMMEDIATE)
|
|
142
|
+
errors.throwNotImplemented('immediate visibility with deqMany');
|
|
143
|
+
const message = this._createArrayDeqMessage(maxNumMessages);
|
|
144
|
+
await this._connImpl._protocol._processMessage(message);
|
|
145
|
+
if (message.noMsgFound) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return message.propsImpls.slice(0, message.numIters);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//---------------------------------------------------------------------------
|
|
152
|
+
// deqOne()
|
|
153
|
+
//
|
|
154
|
+
// Dequeues a single message from the queue.
|
|
155
|
+
//---------------------------------------------------------------------------
|
|
156
|
+
async deqOne() {
|
|
157
|
+
const message = this._createDeqMessage();
|
|
158
|
+
await this._connImpl._protocol._processMessage(message);
|
|
159
|
+
if (message.noMsgFound) {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
return [message.propsImpl];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//---------------------------------------------------------------------------
|
|
166
|
+
// enq()
|
|
167
|
+
//
|
|
168
|
+
// Enqueues one or many messages to the queue based on the number provided.
|
|
169
|
+
//---------------------------------------------------------------------------
|
|
170
|
+
async enq(messages) {
|
|
171
|
+
const propsImpls = messages.map(properties => {
|
|
172
|
+
const impl = new ThinMsgPropsImpl();
|
|
173
|
+
impl._init(properties);
|
|
174
|
+
return impl;
|
|
175
|
+
});
|
|
176
|
+
if (messages.length == 1)
|
|
177
|
+
return await this.enqOne(propsImpls[0]);
|
|
178
|
+
return await this.enqMany(propsImpls);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
//---------------------------------------------------------------------------
|
|
182
|
+
// enqMany()
|
|
183
|
+
//
|
|
184
|
+
// Enqueues multiple messages to the queue.
|
|
185
|
+
//---------------------------------------------------------------------------
|
|
186
|
+
async enqMany(propsImpls) {
|
|
187
|
+
if (this.enqOptions.visibility === AQ_VISIBILITY_IMMEDIATE)
|
|
188
|
+
errors.throwNotImplemented('immediate visibility with enqMany');
|
|
189
|
+
const message = this._createArrayEnqMessage(propsImpls);
|
|
190
|
+
await this._connImpl._protocol._processMessage(message);
|
|
191
|
+
return propsImpls;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//---------------------------------------------------------------------------
|
|
195
|
+
// enqOne()
|
|
196
|
+
//
|
|
197
|
+
// Enqueues a single message to the queue.
|
|
198
|
+
//---------------------------------------------------------------------------
|
|
199
|
+
async enqOne(propsImpl) {
|
|
200
|
+
// No need to set payloadJson or similar; _writePayload handles OSON/JSON
|
|
201
|
+
const message = this._createEnqMessage(propsImpl);
|
|
202
|
+
await this._connImpl._protocol._processMessage(message);
|
|
203
|
+
return [propsImpl];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//---------------------------------------------------------------------------
|
|
207
|
+
// _getConnImpl()
|
|
208
|
+
//
|
|
209
|
+
// Common method on all classes that make use of a connection -- used to
|
|
210
|
+
// ensure serialization of all use of the connection.
|
|
211
|
+
//---------------------------------------------------------------------------
|
|
212
|
+
_getConnImpl() {
|
|
213
|
+
return this._connImpl;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class ThinDeqOptionsImpl {
|
|
219
|
+
|
|
220
|
+
constructor() {
|
|
221
|
+
this.condition = null;
|
|
222
|
+
this.consumerName = null;
|
|
223
|
+
this.correlation = null;
|
|
224
|
+
this.deliveryMode = constants.TNS_AQ_MSG_PERSISTENT;
|
|
225
|
+
this.mode = constants.TNS_AQ_DEQ_REMOVE;
|
|
226
|
+
this.msgId = null;
|
|
227
|
+
this.navigation = constants.TNS_AQ_DEQ_NEXT_MSG;
|
|
228
|
+
this.transformation = null;
|
|
229
|
+
this.visibility = constants.TNS_AQ_DEQ_ON_COMMIT;
|
|
230
|
+
this.wait = constants.TNS_AQ_DEQ_WAIT_FOREVER;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
getCondition() {
|
|
234
|
+
return this.condition;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
getConsumerName() {
|
|
238
|
+
return this.consumerName;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
getCorrelation() {
|
|
242
|
+
return this.correlation;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
getMsgId() {
|
|
246
|
+
return this.msgId;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getMode() {
|
|
250
|
+
return this.mode;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
getNavigation() {
|
|
254
|
+
return this.navigation;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
getTransformation() {
|
|
258
|
+
return this.transformation;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getVisibility() {
|
|
262
|
+
return this.visibility;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
getWait() {
|
|
266
|
+
return this.wait;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
setCondition(value) {
|
|
270
|
+
this.condition = value;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
setConsumerName(value) {
|
|
274
|
+
this.consumerName = value;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
setCorrelation(value) {
|
|
278
|
+
this.correlation = value;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
setDeliveryMode(value) {
|
|
282
|
+
this.deliveryMode = value;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
setMode(value) {
|
|
286
|
+
this.mode = value;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
setMsgId(value) {
|
|
290
|
+
this.msgId = value;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
setNavigation(value) {
|
|
294
|
+
this.navigation = value;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
setTransformation(value) {
|
|
298
|
+
this.transformation = value;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
setVisibility(value) {
|
|
302
|
+
this.visibility = value;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
setWait(value) {
|
|
306
|
+
this.wait = value;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
class ThinEnqOptionsImpl {
|
|
312
|
+
|
|
313
|
+
constructor() {
|
|
314
|
+
this.transformation = null;
|
|
315
|
+
this.visibility = constants.TNS_AQ_ENQ_ON_COMMIT;
|
|
316
|
+
this.deliveryMode = constants.TNS_AQ_MSG_PERSISTENT;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
getDeliveryMode() {
|
|
320
|
+
return this.deliveryMode;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
getTransformation() {
|
|
324
|
+
errors.throwNotImplemented('transformation');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
getVisibility() {
|
|
328
|
+
return this.visibility;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
setDeliveryMode(value) {
|
|
332
|
+
this.deliveryMode = value;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// eslint-disable-next-line no-unused-vars
|
|
336
|
+
setTransformation(value) {
|
|
337
|
+
errors.throwNotImplemented('transformation');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
setVisibility(value) {
|
|
341
|
+
this.visibility = value;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
class ThinMsgPropsImpl {
|
|
347
|
+
|
|
348
|
+
constructor() {
|
|
349
|
+
this.delay = constants.TNS_AQ_MSG_NO_DELAY;
|
|
350
|
+
this.correlation = null;
|
|
351
|
+
this.exceptionq = null;
|
|
352
|
+
this.expiration = constants.TNS_AQ_MSG_NO_EXPIRATION;
|
|
353
|
+
this.priority = 0;
|
|
354
|
+
this.recipients = [];
|
|
355
|
+
this.numAttempts = 0;
|
|
356
|
+
this.deliveryMode = 0;
|
|
357
|
+
this.enqTime = null;
|
|
358
|
+
this.msgId = null;
|
|
359
|
+
this.state = 0;
|
|
360
|
+
this.payload = null;
|
|
361
|
+
this.enqTxnId = null;
|
|
362
|
+
this.senderAgentName = null;
|
|
363
|
+
this.senderAgentAddress = null;
|
|
364
|
+
this.senderAgentProtocol = 0;
|
|
365
|
+
this.originalMsgId = null;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//---------------------------------------------------------------------------
|
|
369
|
+
// _init()
|
|
370
|
+
//
|
|
371
|
+
// Initializes the message properties from the provided properties object.
|
|
372
|
+
//---------------------------------------------------------------------------
|
|
373
|
+
_init(properties) {
|
|
374
|
+
this.payload = properties.payload;
|
|
375
|
+
if (properties.correlation !== undefined)
|
|
376
|
+
this.correlation = properties.correlation;
|
|
377
|
+
if (properties.delay !== undefined)
|
|
378
|
+
this.delay = properties.delay;
|
|
379
|
+
if (properties.exceptionQueue !== undefined)
|
|
380
|
+
this.exceptionQueue = properties.exceptionQueue;
|
|
381
|
+
if (properties.expiration !== undefined)
|
|
382
|
+
this.expiration = properties.expiration;
|
|
383
|
+
if (properties.priority !== undefined)
|
|
384
|
+
this.priority = properties.priority;
|
|
385
|
+
if (properties.recipients !== undefined)
|
|
386
|
+
this.recipients = properties.recipients;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
getNumAttempts() {
|
|
390
|
+
return this.numAttempts;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
getCorrelation() {
|
|
394
|
+
return this.correlation;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
getDelay() {
|
|
398
|
+
return this.delay;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
getDeliveryMode() {
|
|
402
|
+
return this.deliveryMode;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
getEnqTime() {
|
|
406
|
+
return this.enqTime;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
getExceptionQueue() {
|
|
410
|
+
return this.exceptionq;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
getExpiration() {
|
|
414
|
+
return this.expiration;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
getMsgId() {
|
|
418
|
+
return this.msgId;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
getOriginalMsgId() {
|
|
422
|
+
return this.originalMsgId;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
getPayload() {
|
|
426
|
+
return this.payload;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
getPriority() {
|
|
430
|
+
return this.priority;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
getState() {
|
|
434
|
+
return this.state;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
setCorrelation(value) {
|
|
438
|
+
this.correlation = value;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
setDelay(value) {
|
|
442
|
+
this.delay = value;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
setExceptionQueue(value) {
|
|
446
|
+
this.exceptionq = value;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
setExpiration(value) {
|
|
450
|
+
this.expiration = value;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
setPayloadBytes(value) {
|
|
454
|
+
this.payload = value;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
setPayloadObject(value) {
|
|
458
|
+
this.payload = value;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
setPayloadJson(value) {
|
|
462
|
+
this.payload = value;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
setPriority(value) {
|
|
466
|
+
this.priority = value;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
setRecipients(value) {
|
|
470
|
+
this.recipients = value;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
module.exports = { ThinQueueImpl };
|
package/lib/thin/connection.js
CHANGED
|
@@ -42,6 +42,7 @@ const types = require('../types.js');
|
|
|
42
42
|
const errors = require("../errors.js");
|
|
43
43
|
const messages = require('./protocol/messages');
|
|
44
44
|
const StatementCache = require('./statementCache.js');
|
|
45
|
+
const { ThinQueueImpl } = require('./aq.js');
|
|
45
46
|
|
|
46
47
|
const finalizationRegistry = new global.FinalizationRegistry((heldValue) => {
|
|
47
48
|
heldValue.disconnect();
|
|
@@ -170,7 +171,7 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
170
171
|
//
|
|
171
172
|
// Calls the RPC that executes a SQL statement and returns the results.
|
|
172
173
|
//---------------------------------------------------------------------------
|
|
173
|
-
async _execute(statement, numIters, binds, options, executeManyFlag) {
|
|
174
|
+
async _execute(statement, numIters, binds, options, executeManyFlag, internalTempLobs = []) {
|
|
174
175
|
|
|
175
176
|
// Throw error if executeMany is not called on a DML statement or PL/SQL
|
|
176
177
|
if (executeManyFlag && statement.isQuery) {
|
|
@@ -194,7 +195,7 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
for (let i = 0; i < binds.length; i++) {
|
|
197
|
-
await this._bind(statement, binds[i], i + 1);
|
|
198
|
+
await this._bind(statement, binds[i], i + 1, internalTempLobs);
|
|
198
199
|
}
|
|
199
200
|
if (statement.isPlSql && (options.batchErrors || options.dmlRowCounts)) {
|
|
200
201
|
errors.throwErr(errors.ERR_EXEC_MODE_ONLY_FOR_DML);
|
|
@@ -781,6 +782,36 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
781
782
|
return (this._pool) ? true : false;
|
|
782
783
|
}
|
|
783
784
|
|
|
785
|
+
_postConnect(authMessage) {
|
|
786
|
+
let releaseNum;
|
|
787
|
+
let updateNum;
|
|
788
|
+
let portReleaseNum;
|
|
789
|
+
let portUpdateNum;
|
|
790
|
+
|
|
791
|
+
this.dbDomain = authMessage.sessionData['AUTH_SC_DB_DOMAIN'];
|
|
792
|
+
this.dbName = authMessage.sessionData['AUTH_DBNAME'];
|
|
793
|
+
this.maxOpenCursors = Number(authMessage.sessionData['AUTH_MAX_OPEN_CURSORS'] || 0);
|
|
794
|
+
this.serviceName = authMessage.sessionData['AUTH_SC_SERVICE_NAME'];
|
|
795
|
+
this.instanceName = authMessage.sessionData['AUTH_INSTANCENAME'];
|
|
796
|
+
this.maxIdentifierLength = Number(authMessage.sessionData['AUTH_MAX_IDEN_LENGTH'] || 30);
|
|
797
|
+
const fullVersionNum = Number(authMessage.sessionData['AUTH_VERSION_NO']);
|
|
798
|
+
const versionNum = (fullVersionNum >> 24) & 0xFF;
|
|
799
|
+
this.warning = authMessage.warning;
|
|
800
|
+
if (this._protocol.caps.ttcFieldVersion >= constants.TNS_CCAP_FIELD_VERSION_18_1_EXT_1) {
|
|
801
|
+
releaseNum = (fullVersionNum >> 16) & 0xFF;
|
|
802
|
+
updateNum = (fullVersionNum >> 12) & 0x0F;
|
|
803
|
+
portReleaseNum = (fullVersionNum >> 4) & 0xFF;
|
|
804
|
+
portUpdateNum = fullVersionNum & 0x0F;
|
|
805
|
+
} else {
|
|
806
|
+
releaseNum = (fullVersionNum >> 20) & 0x0F;
|
|
807
|
+
updateNum = (fullVersionNum >> 12) & 0xFF;
|
|
808
|
+
portReleaseNum = (fullVersionNum >> 8) & 0x0F;
|
|
809
|
+
portUpdateNum = fullVersionNum & 0xFF;
|
|
810
|
+
}
|
|
811
|
+
this.serverVersionString = versionNum + '.' + releaseNum + '.' + updateNum + '.' + portReleaseNum + '.' + portUpdateNum;
|
|
812
|
+
this.serverVersion = versionNum * 100000000 + releaseNum * 1000000 + updateNum * 10000 + portReleaseNum * 100 + portUpdateNum * 1;
|
|
813
|
+
}
|
|
814
|
+
|
|
784
815
|
/**
|
|
785
816
|
*
|
|
786
817
|
* @param {object} params Configuration of the connection
|
|
@@ -895,6 +926,7 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
895
926
|
if (!params.externalAuth) { // non-token Authentication
|
|
896
927
|
await this._protocol._processMessage(authMessage); // OAUTH
|
|
897
928
|
}
|
|
929
|
+
this._postConnect(authMessage);
|
|
898
930
|
} catch (err) {
|
|
899
931
|
this.nscon.disconnect();
|
|
900
932
|
throw err;
|
|
@@ -935,7 +967,7 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
935
967
|
//---------------------------------------------------------------------------
|
|
936
968
|
// Binds the values by user to the statement object
|
|
937
969
|
//---------------------------------------------------------------------------
|
|
938
|
-
async _bind(stmt, variable, pos = 0) {
|
|
970
|
+
async _bind(stmt, variable, pos = 0, internalTempLobs = []) {
|
|
939
971
|
const bindInfoDict = stmt.bindInfoDict;
|
|
940
972
|
const bindInfoList = stmt.bindInfoList;
|
|
941
973
|
|
|
@@ -977,6 +1009,7 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
977
1009
|
if (val && val.length > 0) {
|
|
978
1010
|
const lobImpl = new ThinLobImpl();
|
|
979
1011
|
await lobImpl.create(this, variable.type);
|
|
1012
|
+
internalTempLobs.push(lobImpl);
|
|
980
1013
|
await lobImpl.write(1, val);
|
|
981
1014
|
variable.values[index] = lobImpl;
|
|
982
1015
|
} else {
|
|
@@ -1071,12 +1104,19 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
1071
1104
|
//---------------------------------------------------------------------------
|
|
1072
1105
|
async execute(sql, numIters, binds, options, executeManyFlag) {
|
|
1073
1106
|
const statement = this._prepare(sql, options);
|
|
1107
|
+
const internalTempLobs = [];
|
|
1074
1108
|
try {
|
|
1075
1109
|
return await this._execute(statement, numIters, binds, options,
|
|
1076
|
-
executeManyFlag);
|
|
1110
|
+
executeManyFlag, internalTempLobs);
|
|
1077
1111
|
} catch (err) {
|
|
1078
1112
|
this._returnStatement(statement);
|
|
1079
1113
|
throw err;
|
|
1114
|
+
} finally {
|
|
1115
|
+
// Add to freelist which will be sent in piggyback fashion
|
|
1116
|
+
for (const lob of internalTempLobs) {
|
|
1117
|
+
this._tempLobsToClose.push(lob._locator);
|
|
1118
|
+
this._tempLobsTotalSize += lob._locator.length;
|
|
1119
|
+
}
|
|
1080
1120
|
}
|
|
1081
1121
|
}
|
|
1082
1122
|
|
|
@@ -1450,5 +1490,15 @@ class ThinConnectionImpl extends ConnectionImpl {
|
|
|
1450
1490
|
getWarning() {
|
|
1451
1491
|
return this.warning;
|
|
1452
1492
|
}
|
|
1493
|
+
|
|
1494
|
+
//---------------------------------------------------------------------------
|
|
1495
|
+
// getQueue()
|
|
1496
|
+
//
|
|
1497
|
+
// Returns a queue for use with advanced queuing.
|
|
1498
|
+
//---------------------------------------------------------------------------
|
|
1499
|
+
getQueue(name, payloadTypeClass, payloadType) {
|
|
1500
|
+
return new ThinQueueImpl(this, name, payloadTypeClass, payloadType);
|
|
1501
|
+
}
|
|
1453
1502
|
}
|
|
1503
|
+
|
|
1454
1504
|
module.exports = ThinConnectionImpl;
|
|
@@ -81,6 +81,7 @@ class Capabilities {
|
|
|
81
81
|
constants.TNS_CCAP_O9LOGON_LONG_PASSWORD;
|
|
82
82
|
this.compileCaps[constants.TNS_CCAP_FIELD_VERSION] = this.ttcFieldVersion;
|
|
83
83
|
this.compileCaps[constants.TNS_CCAP_SERVER_DEFINE_CONV] = 1;
|
|
84
|
+
this.compileCaps[constants.TNS_CCAP_DEQUEUE_WITH_SELECTOR] = 1;
|
|
84
85
|
this.compileCaps[constants.TNS_CCAP_TTC1] =
|
|
85
86
|
constants.TNS_CCAP_FAST_BVEC | constants.TNS_CCAP_END_OF_CALL_STATUS |
|
|
86
87
|
constants.TNS_CCAP_IND_RCD;
|
|
@@ -118,7 +119,8 @@ class Capabilities {
|
|
|
118
119
|
this.compileCaps[constants.TNS_CCAP_TTC4] |= constants.TNS_CCAP_END_OF_REQUEST;
|
|
119
120
|
}
|
|
120
121
|
this.compileCaps[constants.TNS_CCAP_CTB_FEATURE_BACKPORT] =
|
|
121
|
-
constants.TNS_CCAP_CTB_IMPLICIT_POOL
|
|
122
|
+
constants.TNS_CCAP_CTB_IMPLICIT_POOL |
|
|
123
|
+
constants.TNS_CCAP_CTB_OAUTH_MSG_ON_ERR;
|
|
122
124
|
this.compileCaps[constants.TNS_CCAP_TTC5] =
|
|
123
125
|
constants.TNS_CCAP_VECTOR_SUPPORT |
|
|
124
126
|
constants.TNS_CCAP_TTC5_SESSIONLESS_TXNS;
|