oracledb 5.5.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 -1875
- package/LICENSE.txt +8 -222
- package/NOTICE.txt +1 -1
- package/README.md +38 -30
- package/SECURITY.md +38 -0
- 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 +1047 -345
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +23 -9
- package/lib/queryStream.js +14 -7
- package/lib/resultset.js +291 -183
- 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 -110
- 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.5.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.5.0-linux-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.5.0-win32-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/lob.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
// Copyright (c) 2016,
|
|
1
|
+
// Copyright (c) 2016, 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
|
//
|
|
@@ -20,40 +27,10 @@
|
|
|
20
27
|
'use strict';
|
|
21
28
|
|
|
22
29
|
const { Duplex } = require('stream');
|
|
30
|
+
const constants = require('./constants.js');
|
|
31
|
+
const errors = require('./errors.js');
|
|
23
32
|
const nodbUtil = require('./util.js');
|
|
24
|
-
|
|
25
|
-
//-----------------------------------------------------------------------------
|
|
26
|
-
// close()
|
|
27
|
-
// Close the LOB and make it unusable for further operations. If the LOB is
|
|
28
|
-
// already closed, nothing is done in order to support multiple close() calls.
|
|
29
|
-
//
|
|
30
|
-
// This method is deprecated and will be removed in a future version of the
|
|
31
|
-
// node-oracledb driver. Use lob.destroy() instead. NOTE: this method will
|
|
32
|
-
// emit a duplicate "close" event in order to be compatible with previous
|
|
33
|
-
// versions of node-oracledb.
|
|
34
|
-
//-----------------------------------------------------------------------------
|
|
35
|
-
async function close() {
|
|
36
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
37
|
-
if (this.valid) {
|
|
38
|
-
try {
|
|
39
|
-
await this._close();
|
|
40
|
-
this.emit('close');
|
|
41
|
-
} catch (err) {
|
|
42
|
-
this.destroy(err);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//-----------------------------------------------------------------------------
|
|
49
|
-
// getData()
|
|
50
|
-
// Returns all of the data in the LOB as a single string or buffer.
|
|
51
|
-
//-----------------------------------------------------------------------------
|
|
52
|
-
async function getData() {
|
|
53
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
54
|
-
return await this._getData();
|
|
55
|
-
}
|
|
56
|
-
|
|
33
|
+
const types = require('./types.js');
|
|
57
34
|
|
|
58
35
|
class Lob extends Duplex {
|
|
59
36
|
|
|
@@ -68,20 +45,17 @@ class Lob extends Duplex {
|
|
|
68
45
|
});
|
|
69
46
|
}
|
|
70
47
|
|
|
71
|
-
_extend(oracledb) {
|
|
72
|
-
this._oracledb = oracledb;
|
|
73
|
-
this.close = nodbUtil.callbackify(nodbUtil.preventConcurrent(nodbUtil.serialize(close), 'NJS-023'));
|
|
74
|
-
this.getData = nodbUtil.callbackify(nodbUtil.preventConcurrent(nodbUtil.serialize(getData), 'NJS-023'));
|
|
75
|
-
this._serializedRead = nodbUtil.serialize(this.__read);
|
|
76
|
-
this._serializedWrite = nodbUtil.serialize(this.__write);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
48
|
// called by stream.destroy() and ensures that the LOB is closed if it has
|
|
80
49
|
// not already been closed (never called directly)
|
|
81
50
|
async _destroy(err, cb) {
|
|
82
|
-
if
|
|
51
|
+
// if LOB was already closed, nothing to do!
|
|
52
|
+
if (err && err.message.startsWith("NJS-108:"))
|
|
53
|
+
delete this._impl;
|
|
54
|
+
if (this._impl) {
|
|
55
|
+
const lobImpl = this._impl;
|
|
56
|
+
delete this._impl;
|
|
83
57
|
try {
|
|
84
|
-
await
|
|
58
|
+
await lobImpl.close();
|
|
85
59
|
} catch (closeErr) {
|
|
86
60
|
cb(closeErr);
|
|
87
61
|
return;
|
|
@@ -90,19 +64,10 @@ class Lob extends Duplex {
|
|
|
90
64
|
cb(err);
|
|
91
65
|
}
|
|
92
66
|
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
while (!(connection instanceof this._oracledb.Connection))
|
|
98
|
-
connection = connection._parentObj;
|
|
99
|
-
return connection;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// implementation of streaming read; if lob is set to auto-close, the lob is
|
|
103
|
-
// automatically closed within the C code when an error occurs or when there
|
|
104
|
-
// are no more bytes to transfer; all that needs to be done in the JS layer
|
|
105
|
-
// is to destroy the streaming LOB
|
|
67
|
+
// implementation of streaming read; if LOB is set to auto-close, the lob is
|
|
68
|
+
// automatically closed when an error occurs or when there are no more bytes
|
|
69
|
+
// to transfer; all that needs to be done here is to destroy the streaming
|
|
70
|
+
// LOB
|
|
106
71
|
async _read() {
|
|
107
72
|
try {
|
|
108
73
|
const data = await this._serializedRead(this.offset);
|
|
@@ -116,19 +81,44 @@ class Lob extends Duplex {
|
|
|
116
81
|
}
|
|
117
82
|
}
|
|
118
83
|
} catch (err) {
|
|
119
|
-
this.
|
|
84
|
+
if (this._autoCloseLob)
|
|
85
|
+
this.destroy(err);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// simple wrapper so that serialization can take place on a JavaScript fn
|
|
91
|
+
async _readData(offset) {
|
|
92
|
+
errors.assert(this._impl, errors.ERR_INVALID_LOB);
|
|
93
|
+
try {
|
|
94
|
+
return await this._impl.read(offset);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
throw errors.transformErr(err, this._readData);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// called to associate a LOB implementation with this user facing object
|
|
101
|
+
_setup(lobImpl, autoCloseLob) {
|
|
102
|
+
this._impl = lobImpl;
|
|
103
|
+
this._chunkSize = lobImpl.getChunkSize();
|
|
104
|
+
this._pieceSize = lobImpl.getPieceSize();
|
|
105
|
+
this._length = lobImpl.getLength();
|
|
106
|
+
this._type = lobImpl.getType();
|
|
107
|
+
if (typeof this._type === 'number') {
|
|
108
|
+
this._type = types.getTypeByNum(this._type);
|
|
120
109
|
}
|
|
110
|
+
this._autoCloseLob = autoCloseLob;
|
|
121
111
|
}
|
|
122
112
|
|
|
123
|
-
// implementation of streaming write; if
|
|
113
|
+
// implementation of streaming write; if LOB is set to auto-close, the lob is
|
|
124
114
|
// automatically closed in the "finish" event; all that needs to be done here
|
|
125
115
|
// is to destroy the streaming LOB
|
|
126
116
|
async _write(data, encoding, cb) {
|
|
127
117
|
|
|
128
118
|
// convert data if needed
|
|
129
|
-
if (this.type ==
|
|
119
|
+
if (this.type == constants.DB_TYPE_BLOB && !Buffer.isBuffer(data)) {
|
|
130
120
|
data = Buffer.from(data);
|
|
131
|
-
} else if (this.type ==
|
|
121
|
+
} else if (this.type == constants.DB_TYPE_CLOB &&
|
|
132
122
|
Buffer.isBuffer(data)) {
|
|
133
123
|
data = data.toString();
|
|
134
124
|
}
|
|
@@ -136,8 +126,9 @@ class Lob extends Duplex {
|
|
|
136
126
|
try {
|
|
137
127
|
await this._serializedWrite(this.offset, data);
|
|
138
128
|
} catch (err) {
|
|
129
|
+
if (this._autoCloseLob)
|
|
130
|
+
this.destroy(err);
|
|
139
131
|
cb(err);
|
|
140
|
-
this.destroy(err);
|
|
141
132
|
return;
|
|
142
133
|
}
|
|
143
134
|
this.offset += data.length;
|
|
@@ -145,6 +136,103 @@ class Lob extends Duplex {
|
|
|
145
136
|
|
|
146
137
|
}
|
|
147
138
|
|
|
139
|
+
// simple wrapper so that serialization can take place on a JavaScript fn
|
|
140
|
+
async _writeData(offset, data) {
|
|
141
|
+
errors.assert(this._impl, errors.ERR_INVALID_LOB);
|
|
142
|
+
try {
|
|
143
|
+
await this._impl.write(offset, data);
|
|
144
|
+
} catch (err) {
|
|
145
|
+
throw errors.transformErr(err, this._writeData);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//---------------------------------------------------------------------------
|
|
150
|
+
// chunkSize
|
|
151
|
+
//
|
|
152
|
+
// Property for the chunk size of the LOB.
|
|
153
|
+
//---------------------------------------------------------------------------
|
|
154
|
+
get chunkSize() {
|
|
155
|
+
return this._chunkSize;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//---------------------------------------------------------------------------
|
|
159
|
+
// close()
|
|
160
|
+
//
|
|
161
|
+
// Close the LOB and make it unusable for further operations. If the LOB is
|
|
162
|
+
// already closed, nothing is done in order to support multiple close()
|
|
163
|
+
// calls.
|
|
164
|
+
//
|
|
165
|
+
// This method is deprecated and will be removed in a future version of the
|
|
166
|
+
// node-oracledb driver. Use lob.destroy() instead. NOTE: this method will
|
|
167
|
+
// emit a duplicate "close" event in order to be compatible with previous
|
|
168
|
+
// versions of node-oracledb.
|
|
169
|
+
//---------------------------------------------------------------------------
|
|
170
|
+
async close() {
|
|
171
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
172
|
+
if (this._impl) {
|
|
173
|
+
const lobImpl = this._impl;
|
|
174
|
+
delete this._impl;
|
|
175
|
+
try {
|
|
176
|
+
await lobImpl.close();
|
|
177
|
+
this.emit('close');
|
|
178
|
+
} catch (err) {
|
|
179
|
+
this.destroy(err);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
//---------------------------------------------------------------------------
|
|
185
|
+
// getData()
|
|
186
|
+
//
|
|
187
|
+
// Returns all of the data in the LOB as a single string or buffer.
|
|
188
|
+
//---------------------------------------------------------------------------
|
|
189
|
+
async getData() {
|
|
190
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
191
|
+
errors.assert(this._impl, errors.ERR_INVALID_LOB);
|
|
192
|
+
return await this._impl.getData();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
//---------------------------------------------------------------------------
|
|
196
|
+
// length
|
|
197
|
+
//
|
|
198
|
+
// Property for the length of the LOB.
|
|
199
|
+
//---------------------------------------------------------------------------
|
|
200
|
+
get length() {
|
|
201
|
+
return this._length;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
//---------------------------------------------------------------------------
|
|
205
|
+
// pieceSize
|
|
206
|
+
//
|
|
207
|
+
// Property for the size to use for each piece that is transferred when
|
|
208
|
+
// reading from the LOB.
|
|
209
|
+
//---------------------------------------------------------------------------
|
|
210
|
+
get pieceSize() {
|
|
211
|
+
return this._pieceSize;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
set pieceSize(value) {
|
|
215
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0, "pieceSize");
|
|
216
|
+
errors.assert(this._impl, errors.ERR_INVALID_LOB);
|
|
217
|
+
this._impl.setPieceSize(value);
|
|
218
|
+
this._pieceSize = value;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
//---------------------------------------------------------------------------
|
|
222
|
+
// type
|
|
223
|
+
//
|
|
224
|
+
// Property for the type of the LOB.
|
|
225
|
+
//---------------------------------------------------------------------------
|
|
226
|
+
get type() {
|
|
227
|
+
return this._type;
|
|
228
|
+
}
|
|
229
|
+
|
|
148
230
|
}
|
|
149
231
|
|
|
232
|
+
nodbUtil.wrapFns(Lob.prototype, errors.ERR_BUSY_LOB,
|
|
233
|
+
"close",
|
|
234
|
+
"getData");
|
|
235
|
+
Lob.prototype._serializedRead = nodbUtil.serialize(Lob.prototype._readData);
|
|
236
|
+
Lob.prototype._serializedWrite = nodbUtil.serialize(Lob.prototype._writeData);
|
|
237
|
+
|
|
150
238
|
module.exports = Lob;
|