oracledb 5.4.0 → 6.0.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/CHANGELOG.md +1 -1849
- package/LICENSE.txt +8 -222
- package/NOTICE.txt +1 -1
- package/README.md +38 -30
- package/SECURITY.md +38 -0
- package/THIRD_PARTY_LICENSES.txt +1 -1
- package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +113 -0
- package/examples/dbconfig.js +100 -0
- package/examples/example.js +156 -0
- package/index.js +26 -0
- package/lib/aqDeqOptions.js +146 -7
- package/lib/aqEnqOptions.js +59 -7
- package/lib/aqMessage.js +118 -7
- package/lib/aqQueue.js +242 -53
- package/lib/connection.js +1324 -465
- package/lib/constants.js +203 -0
- package/lib/dbObject.js +346 -32
- package/lib/errors.js +781 -0
- package/lib/impl/aqDeqOptions.js +197 -0
- package/lib/impl/aqEnqOptions.js +89 -0
- package/lib/impl/aqMessage.js +134 -0
- package/lib/impl/aqQueue.js +81 -0
- package/lib/impl/connection.js +529 -0
- package/lib/impl/dbObject.js +159 -0
- package/lib/impl/index.js +59 -0
- package/lib/impl/lob.js +85 -0
- package/lib/impl/pool.js +195 -0
- package/lib/impl/resultset.js +223 -0
- package/lib/impl/sodaCollection.js +174 -0
- package/lib/impl/sodaDatabase.js +81 -0
- package/lib/impl/sodaDocCursor.js +63 -0
- package/lib/impl/sodaDocument.js +98 -0
- package/lib/impl/sodaOperation.js +109 -0
- package/lib/lob.js +156 -68
- package/lib/oracledb.js +1051 -257
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +23 -9
- package/lib/queryStream.js +14 -7
- package/lib/resultset.js +292 -171
- package/lib/settings.js +191 -0
- package/lib/sodaCollection.js +214 -201
- package/lib/sodaDatabase.js +107 -71
- package/lib/sodaDocCursor.js +44 -32
- package/lib/sodaDocument.js +76 -14
- package/lib/sodaOperation.js +131 -118
- package/lib/thin/connection.js +1038 -0
- package/lib/thin/dbObject.js +629 -0
- package/lib/thin/index.js +40 -0
- package/lib/thin/lob.js +188 -0
- package/lib/thin/pool.js +481 -0
- package/lib/thin/protocol/buffer.js +1040 -0
- package/lib/thin/protocol/capabilities.js +116 -0
- package/lib/thin/protocol/constants.js +764 -0
- package/lib/thin/protocol/encryptDecrypt.js +185 -0
- package/lib/thin/protocol/messages/auth.js +348 -0
- package/lib/thin/protocol/messages/base.js +475 -0
- package/lib/thin/protocol/messages/commit.js +56 -0
- package/lib/thin/protocol/messages/dataType.js +382 -0
- package/lib/thin/protocol/messages/execute.js +312 -0
- package/lib/thin/protocol/messages/fetch.js +60 -0
- package/lib/thin/protocol/messages/index.js +53 -0
- package/lib/thin/protocol/messages/lobOp.js +200 -0
- package/lib/thin/protocol/messages/logOff.js +53 -0
- package/lib/thin/protocol/messages/ping.js +56 -0
- package/lib/thin/protocol/messages/protocol.js +78 -0
- package/lib/thin/protocol/messages/rollback.js +56 -0
- package/lib/thin/protocol/messages/sessionRelease.js +60 -0
- package/lib/thin/protocol/messages/withData.js +811 -0
- package/lib/thin/protocol/oson.js +660 -0
- package/lib/thin/protocol/packet.js +520 -0
- package/lib/thin/protocol/protocol.js +202 -0
- package/lib/thin/protocol/utils.js +88 -0
- package/lib/thin/resultSet.js +122 -0
- package/lib/thin/sqlnet/connStrategy.js +175 -0
- package/lib/thin/sqlnet/constants.js +199 -0
- package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
- package/lib/thin/sqlnet/navNodes.js +870 -0
- package/lib/thin/sqlnet/networkSession.js +620 -0
- package/lib/thin/sqlnet/ntTcp.js +525 -0
- package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
- package/lib/thin/sqlnet/packet.js +405 -0
- package/lib/thin/sqlnet/paramParser.js +205 -0
- package/lib/thin/sqlnet/sessionAtts.js +160 -0
- package/lib/thin/statement.js +301 -0
- package/lib/thin/util.js +289 -0
- package/lib/transformer.js +250 -0
- package/lib/types.js +357 -0
- package/lib/util.js +194 -108
- package/lib/version.js +36 -0
- package/package/README.md +33 -30
- package/package/install.js +89 -64
- package/package/prunebinaries.js +60 -12
- package/package.json +3 -3
- package/build/Release/oracledb-5.4.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-linux-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-win32-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/sodaOperation.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
// Copyright (c) 2018,
|
|
1
|
+
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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.
|
|
7
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.
|
|
8
15
|
// You may obtain a copy of the License at
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
16
|
//
|
|
11
|
-
//
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
-
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
14
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.
|
|
15
22
|
// See the License for the specific language governing permissions and
|
|
16
23
|
// limitations under the License.
|
|
17
24
|
//
|
|
@@ -19,144 +26,142 @@
|
|
|
19
26
|
|
|
20
27
|
'use strict';
|
|
21
28
|
|
|
29
|
+
const SodaDocCursor = require('./sodaDocCursor.js');
|
|
30
|
+
const SodaDocument = require('./sodaDocument.js');
|
|
31
|
+
const errors = require('./errors.js');
|
|
22
32
|
const nodbUtil = require('./util.js');
|
|
33
|
+
const settings = require('./settings.js');
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
// count()
|
|
26
|
-
// Return a count of the number of documents that match the search criteria.
|
|
27
|
-
//-----------------------------------------------------------------------------
|
|
28
|
-
async function count() {
|
|
29
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
30
|
-
return await this._count(this._options);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//-----------------------------------------------------------------------------
|
|
35
|
-
// getOne()
|
|
36
|
-
// Return the first document that matches the search criteria.
|
|
37
|
-
//-----------------------------------------------------------------------------
|
|
38
|
-
async function getOne() {
|
|
39
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
40
|
-
return await this._getOne(this._options);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//-----------------------------------------------------------------------------
|
|
45
|
-
// replaceOne()
|
|
46
|
-
// Replace the first document that matches the search criteria with the
|
|
47
|
-
// specified document.
|
|
48
|
-
//-----------------------------------------------------------------------------
|
|
49
|
-
async function replaceOne(content) {
|
|
50
|
-
nodbUtil.checkArgCount(arguments, 1, 1);
|
|
51
|
-
nodbUtil.assert(nodbUtil.isObject(content) ||
|
|
52
|
-
nodbUtil.isSodaDocument(content), 'NJS-005', 1);
|
|
35
|
+
class SodaOperation {
|
|
53
36
|
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
constructor() {
|
|
38
|
+
this._options = {
|
|
39
|
+
autoCommit: settings.autoCommit,
|
|
40
|
+
fetchArraySize: settings.fetchArraySize
|
|
41
|
+
};
|
|
56
42
|
}
|
|
57
43
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
//-----------------------------------------------------------------------------
|
|
67
|
-
async function replaceOneAndGet(content) {
|
|
68
|
-
nodbUtil.checkArgCount(arguments, 1, 1);
|
|
69
|
-
nodbUtil.assert(nodbUtil.isObject(content) ||
|
|
70
|
-
nodbUtil.isSodaDocument(content), 'NJS-005', 1);
|
|
71
|
-
|
|
72
|
-
if (!nodbUtil.isSodaDocument(content)) {
|
|
73
|
-
content = Buffer.from(JSON.stringify(content));
|
|
44
|
+
//---------------------------------------------------------------------------
|
|
45
|
+
// count()
|
|
46
|
+
//
|
|
47
|
+
// Return a count of the number of documents that match the search criteria.
|
|
48
|
+
//---------------------------------------------------------------------------
|
|
49
|
+
async count() {
|
|
50
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
51
|
+
return await this._impl.count(this._options);
|
|
74
52
|
}
|
|
75
53
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//-----------------------------------------------------------------------------
|
|
92
|
-
// getCursor()
|
|
93
|
-
// Return a cursor which will return the documents that match the search
|
|
94
|
-
// criteria.
|
|
95
|
-
//-----------------------------------------------------------------------------
|
|
96
|
-
async function getCursor() {
|
|
97
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
98
|
-
return await this._getCursor(this._options);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
//-----------------------------------------------------------------------------
|
|
103
|
-
// getDocuments()
|
|
104
|
-
// Return an array of documents that match the search criteria.
|
|
105
|
-
//-----------------------------------------------------------------------------
|
|
106
|
-
async function getDocuments() {
|
|
107
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
108
|
-
return await this._getDocuments(this._options);
|
|
109
|
-
}
|
|
54
|
+
//---------------------------------------------------------------------------
|
|
55
|
+
// getCursor()
|
|
56
|
+
//
|
|
57
|
+
// Return a cursor which will return the documents that match the search
|
|
58
|
+
// criteria.
|
|
59
|
+
//---------------------------------------------------------------------------
|
|
60
|
+
async getCursor() {
|
|
61
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
62
|
+
const cursor = new SodaDocCursor();
|
|
63
|
+
cursor._impl = await this._impl.getCursor(this._options);
|
|
64
|
+
return cursor;
|
|
65
|
+
}
|
|
110
66
|
|
|
67
|
+
//---------------------------------------------------------------------------
|
|
68
|
+
// getDocuments()
|
|
69
|
+
// Return an array of documents that match the search criteria.
|
|
70
|
+
//---------------------------------------------------------------------------
|
|
71
|
+
async getDocuments() {
|
|
72
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
73
|
+
const docImpls = await this._impl.getDocuments(this._options);
|
|
74
|
+
const returnVal = new Array(docImpls.length);
|
|
75
|
+
for (let i = 0; i < docImpls.length; i++) {
|
|
76
|
+
returnVal[i] = new SodaDocument();
|
|
77
|
+
returnVal[i]._impl = docImpls[i];
|
|
78
|
+
}
|
|
79
|
+
return returnVal;
|
|
80
|
+
}
|
|
111
81
|
|
|
112
|
-
|
|
82
|
+
//---------------------------------------------------------------------------
|
|
83
|
+
// getOne()
|
|
84
|
+
//
|
|
85
|
+
// Return the first document that matches the search criteria.
|
|
86
|
+
//---------------------------------------------------------------------------
|
|
87
|
+
async getOne() {
|
|
88
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
89
|
+
const docImpl = await this._impl.getOne(this._options);
|
|
90
|
+
if (docImpl) {
|
|
91
|
+
const doc = new SodaDocument;
|
|
92
|
+
doc._impl = docImpl;
|
|
93
|
+
return doc;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
113
96
|
|
|
114
|
-
|
|
115
|
-
|
|
97
|
+
//---------------------------------------------------------------------------
|
|
98
|
+
// replaceOne()
|
|
99
|
+
//
|
|
100
|
+
// Replace the first document that matches the search criteria with the
|
|
101
|
+
// specified document.
|
|
102
|
+
//---------------------------------------------------------------------------
|
|
103
|
+
async replaceOne(content) {
|
|
104
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
105
|
+
content = nodbUtil.verifySodaDoc(content);
|
|
106
|
+
return await this._impl.replaceOne(this._options, content);
|
|
116
107
|
}
|
|
117
108
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
//---------------------------------------------------------------------------
|
|
110
|
+
// replaceOneAndGet()
|
|
111
|
+
//
|
|
112
|
+
// Replace the first document that matches the search criteria with the
|
|
113
|
+
// specified document and then return a result document containing metadata.
|
|
114
|
+
//---------------------------------------------------------------------------
|
|
115
|
+
async replaceOneAndGet(content) {
|
|
116
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
117
|
+
content = nodbUtil.verifySodaDoc(content);
|
|
118
|
+
const docImpl = await this._impl.replaceOneAndGet(this._options, content);
|
|
119
|
+
if (docImpl) {
|
|
120
|
+
const doc = new SodaDocument();
|
|
121
|
+
doc._impl = docImpl;
|
|
122
|
+
return doc;
|
|
123
|
+
}
|
|
126
124
|
}
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
//---------------------------------------------------------------------------
|
|
127
|
+
// remove()
|
|
128
|
+
//
|
|
129
|
+
// Remove the documents that match the search criteria from the collection
|
|
130
|
+
// and return information about the operation to the caller.
|
|
131
|
+
//---------------------------------------------------------------------------
|
|
132
|
+
async remove() {
|
|
133
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
134
|
+
return await this._impl.remove(this._options);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
// fetchArraySize - a non-terminal function that can chain further
|
|
133
138
|
fetchArraySize(n) {
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
140
|
+
errors.assertParamValue(Number.isInteger(n) && n >= 0, 1);
|
|
136
141
|
this._options.fetchArraySize = n;
|
|
137
142
|
return this;
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
// filter property - a non-terminal function and can chain further
|
|
141
146
|
filter(f) {
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
errors.assertArgCount (arguments, 1, 1);
|
|
148
|
+
errors.assertParamValue(nodbUtil.isObject(f), 1);
|
|
144
149
|
this._options.filter = JSON.stringify(f);
|
|
145
150
|
return this;
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
// hint - a non-terminal function and can chain further
|
|
149
154
|
hint(val) {
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
156
|
+
errors.assertParamValue(typeof val === 'string', 1);
|
|
152
157
|
this._options.hint = val;
|
|
153
158
|
return this;
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
// key - a non-terminal function and can chain further
|
|
157
162
|
key(k) {
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
164
|
+
errors.assertParamValue(typeof k === 'string', 1);
|
|
160
165
|
this._options.key = k;
|
|
161
166
|
this._options.keys = undefined;
|
|
162
167
|
return this;
|
|
@@ -164,11 +169,11 @@ class SodaOperation {
|
|
|
164
169
|
|
|
165
170
|
// keys - a non-terminal function and can chain further
|
|
166
171
|
keys(arr) {
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
173
|
+
errors.assertParamValue(Array.isArray(arr), 1);
|
|
169
174
|
|
|
170
175
|
for (let i = 0; i < arr.length; i++) {
|
|
171
|
-
|
|
176
|
+
errors.assertParamValue(typeof arr[i] === 'string', 1);
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
this._options.keys = arr;
|
|
@@ -178,29 +183,37 @@ class SodaOperation {
|
|
|
178
183
|
|
|
179
184
|
// limit property - a non-terminal function and can chain further
|
|
180
185
|
limit(n) {
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
187
|
+
errors.assertParamValue(typeof n === 'number', 1);
|
|
183
188
|
this._options.limit = n;
|
|
184
189
|
return this;
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
// skip property - a non-terminal function and can chain further
|
|
188
193
|
skip(n) {
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
195
|
+
errors.assertParamValue(typeof n === 'number', 1);
|
|
191
196
|
this._options.skip = n;
|
|
192
197
|
return this;
|
|
193
198
|
}
|
|
194
199
|
|
|
195
200
|
// version property - a non-terminal function and can chain further
|
|
196
201
|
version(v) {
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
203
|
+
errors.assertParamValue(typeof v === 'string', 1);
|
|
199
204
|
this._options.version = v;
|
|
200
205
|
return this;
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
}
|
|
204
209
|
|
|
210
|
+
nodbUtil.wrapFns(SodaOperation.prototype,
|
|
211
|
+
"count",
|
|
212
|
+
"getCursor",
|
|
213
|
+
"getDocuments",
|
|
214
|
+
"getOne",
|
|
215
|
+
"remove",
|
|
216
|
+
"replaceOne",
|
|
217
|
+
"replaceOneAndGet");
|
|
205
218
|
|
|
206
219
|
module.exports = SodaOperation;
|