oracledb 6.0.2 → 6.1.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 +15 -17
- package/SECURITY.md +1 -1
- package/build/Release/oracledb-6.1.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.1.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.1.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.1.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.1.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.1.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/example.js +0 -1
- package/lib/aqQueue.js +40 -26
- package/lib/connection.js +15 -3
- package/lib/errors.js +15 -10
- package/lib/impl/connection.js +9 -0
- package/lib/impl/resultset.js +7 -4
- package/lib/oracledb.js +15 -12
- package/lib/pool.js +11 -2
- package/lib/settings.js +1 -1
- package/lib/sodaCollection.js +1 -1
- package/lib/thin/connection.js +92 -30
- package/lib/thin/dbObject.js +2 -2
- package/lib/thin/lob.js +2 -2
- package/lib/thin/pool.js +153 -71
- package/lib/thin/protocol/buffer.js +24 -6
- package/lib/thin/protocol/constants.js +8 -18
- package/lib/thin/protocol/encryptDecrypt.js +17 -17
- package/lib/thin/protocol/messages/auth.js +27 -31
- package/lib/thin/protocol/messages/base.js +30 -53
- package/lib/thin/protocol/messages/connectionCookie.js +76 -0
- package/lib/thin/protocol/messages/dataType.js +13 -9
- package/lib/thin/protocol/messages/execute.js +11 -11
- package/lib/thin/protocol/messages/index.js +2 -0
- package/lib/thin/protocol/messages/lobOp.js +3 -3
- package/lib/thin/protocol/messages/protocol.js +31 -20
- package/lib/thin/protocol/messages/withData.js +60 -53
- package/lib/thin/protocol/oson.js +4 -4
- package/lib/thin/protocol/packet.js +51 -28
- package/lib/thin/protocol/protocol.js +12 -7
- package/lib/thin/protocol/utils.js +2 -2
- package/lib/thin/resultSet.js +6 -6
- package/lib/thin/sqlnet/connStrategy.js +134 -7
- package/lib/thin/sqlnet/constants.js +2 -0
- package/lib/thin/sqlnet/ezConnectResolver.js +29 -24
- package/lib/thin/sqlnet/navNodes.js +35 -28
- package/lib/thin/sqlnet/networkSession.js +45 -40
- package/lib/thin/sqlnet/ntTcp.js +70 -35
- package/lib/thin/sqlnet/nvStrToNvPair.js +16 -16
- package/lib/thin/sqlnet/packet.js +17 -10
- package/lib/thin/sqlnet/paramParser.js +9 -9
- package/lib/thin/sqlnet/sessionAtts.js +4 -0
- package/lib/thin/statement.js +4 -3
- package/lib/thin/util.js +28 -8
- package/lib/transformer.js +3 -1
- package/lib/util.js +0 -13
- package/lib/version.js +2 -2
- package/package.json +1 -1
- package/build/Release/oracledb-6.0.2-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.0.2-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.0.2-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.0.2-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.0.2-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.0.2-linux-x64.node +0 -0
- package/build/Release/oracledb-6.0.2-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.0.2-win32-x64.node +0 -0
- package/build/Release/oracledb-6.0.2-win32-x64.node-buildinfo.txt +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# node-oracledb version 6.0
|
|
1
|
+
# node-oracledb version 6.1.0
|
|
2
2
|
|
|
3
3
|
The node-oracledb add-on for Node.js powers high performance Oracle Database
|
|
4
4
|
applications. Applications can be written in TypeScript, or directly in
|
|
5
5
|
JavaScript.
|
|
6
6
|
|
|
7
|
-
Use node-oracledb 6.0
|
|
7
|
+
Use node-oracledb 6.1.0 to connect Node.js 14.6, or later, to Oracle
|
|
8
8
|
Database. Older versions of node-oracledb may work with older versions of
|
|
9
9
|
Node.js.
|
|
10
10
|
|
|
@@ -20,12 +20,12 @@ See [Getting Started with Node-oracledb][1] and [Quick Start Node-oracledb Insta
|
|
|
20
20
|
|
|
21
21
|
## Documentation
|
|
22
22
|
|
|
23
|
-
See [Documentation for the Oracle Database Node.js Add-on][
|
|
24
|
-
notes][
|
|
23
|
+
See [Documentation for the Oracle Database Node.js Add-on][9] and the [release
|
|
24
|
+
notes][10].
|
|
25
25
|
|
|
26
26
|
## Examples
|
|
27
27
|
|
|
28
|
-
See the [examples][
|
|
28
|
+
See the [examples][7] directory. Start with [examples/example.js][8].
|
|
29
29
|
|
|
30
30
|
## Help
|
|
31
31
|
|
|
@@ -34,19 +34,16 @@ to join Slack][6]).
|
|
|
34
34
|
|
|
35
35
|
## <a name="testing"></a> Tests
|
|
36
36
|
|
|
37
|
-
To run the test suite see [test/README][
|
|
37
|
+
To run the test suite see [test/README][11].
|
|
38
38
|
|
|
39
39
|
## Contributing
|
|
40
40
|
|
|
41
41
|
This project welcomes contributions from the community. Before submitting a
|
|
42
|
-
pull request, please [review our contribution guide][
|
|
43
|
-
|
|
44
|
-
Oracle gratefully acknowledges the contributions to node-oracledb that have
|
|
45
|
-
been made by the community.
|
|
42
|
+
pull request, please [review our contribution guide][12].
|
|
46
43
|
|
|
47
44
|
## Security
|
|
48
45
|
|
|
49
|
-
Please consult the [security guide]
|
|
46
|
+
Please consult the [security guide][13] for our responsible security
|
|
50
47
|
vulnerability disclosure process.
|
|
51
48
|
|
|
52
49
|
## License
|
|
@@ -79,9 +76,10 @@ limitations under the License.
|
|
|
79
76
|
[4]: https://oracle.github.io/node-oracledb
|
|
80
77
|
[5]: https://node-oracledb.slack.com/
|
|
81
78
|
[6]: https://join.slack.com/t/node-oracledb/shared_invite/enQtNDU4Mjc2NzM5OTA2LWMzY2ZlZDY5MDdlMGZiMGRkY2IzYjI5OGU4YTEzZWM5YjQ3ODUzMjcxNWQyNzE4MzM5YjNkYjVmNDk5OWU5NDM
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
79
|
+
[7]: https://github.com/oracle/node-oracledb/blob/main/examples
|
|
80
|
+
[8]: https://github.com/oracle/node-oracledb/blob/main/examples/example.js
|
|
81
|
+
[9]: https://node-oracledb.readthedocs.io/en/latest/
|
|
82
|
+
[10]: https://node-oracledb.readthedocs.io/en/latest/release_notes.html
|
|
83
|
+
[11]: https://github.com/oracle/node-oracledb/blob/main/test/README.md
|
|
84
|
+
[12]: https://github.com/oracle/node-oracledb/blob/main/CONTRIBUTING.md
|
|
85
|
+
[13]: https://github.com/oracle/node-oracledb/blob/main/SECURITY.md
|
package/SECURITY.md
CHANGED
|
@@ -21,7 +21,7 @@ security features are welcome on GitHub Issues.
|
|
|
21
21
|
|
|
22
22
|
Security updates will be released on a regular cadence. Many of our projects
|
|
23
23
|
will typically release security fixes in conjunction with the
|
|
24
|
-
|
|
24
|
+
Oracle Critical Patch Update program. Additional
|
|
25
25
|
information, including past advisories, is available on our [security alerts][4]
|
|
26
26
|
page.
|
|
27
27
|
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.1.0-darwin-x64.node v18.17.1 98df02823e1fc31b0e57044cd1fb2358dfc620ed 20785f251426f274f4216369b9259908a103384d Mon, 21 Aug 2023 05:58:15 GMT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
98df02823e1fc31b0e57044cd1fb2358dfc620ed
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.1.0-linux-arm64.node v18.15.0 98df02823e1fc31b0e57044cd1fb2358dfc620ed 20785f251426f274f4216369b9259908a103384d Mon, 21 Aug 2023 07:05:34 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.1.0-linux-x64.node v16.20.0 98df02823e1fc31b0e57044cd1fb2358dfc620ed 20785f251426f274f4216369b9259908a103384d Mon, 21 Aug 2023 05:55:55 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.1.0-win32-x64.node v16.19.0 98df02823e1fc31b0e57044cd1fb2358dfc620ed 20785f251426f274f4216369b9259908a103384d Mon, 21 Aug 2023 09:35:54 GMT
|
package/examples/example.js
CHANGED
|
@@ -127,7 +127,6 @@ async function run() {
|
|
|
127
127
|
// For a complete list of options see the documentation.
|
|
128
128
|
options = {
|
|
129
129
|
outFormat: oracledb.OUT_FORMAT_OBJECT, // query result format
|
|
130
|
-
// extendedMetaData: true, // get extra metadata
|
|
131
130
|
// fetchArraySize: 100 // internal buffer allocation size for tuning
|
|
132
131
|
};
|
|
133
132
|
|
package/lib/aqQueue.js
CHANGED
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
'use strict';
|
|
28
28
|
|
|
29
29
|
const { Buffer } = require('buffer');
|
|
30
|
-
const constants = require('./constants.js');
|
|
31
30
|
const errors = require('./errors.js');
|
|
32
31
|
const nodbUtil = require('./util.js');
|
|
33
32
|
const AqDeqOptions = require('./aqDeqOptions.js');
|
|
34
33
|
const AqEnqOptions = require('./aqEnqOptions.js');
|
|
35
34
|
const AqMessage = require('./aqMessage.js');
|
|
36
35
|
const BaseDbObject = require('./dbObject.js');
|
|
36
|
+
const transformer = require('./transformer.js');
|
|
37
|
+
const types = require('./types.js');
|
|
37
38
|
|
|
38
39
|
class AqQueue {
|
|
39
40
|
|
|
@@ -47,6 +48,19 @@ class AqQueue {
|
|
|
47
48
|
value instanceof BaseDbObject);
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
//---------------------------------------------------------------------------
|
|
52
|
+
// _makeMessage()
|
|
53
|
+
//
|
|
54
|
+
// For enqOne()/deqOne()/enqMany()/deqMany(), wrap the return value with JS
|
|
55
|
+
// layer object.
|
|
56
|
+
//---------------------------------------------------------------------------
|
|
57
|
+
_makeMessage(msgImpl) {
|
|
58
|
+
const msg = new AqMessage();
|
|
59
|
+
msg._impl = msgImpl;
|
|
60
|
+
msg._payloadTypeClass = this._payloadTypeClass;
|
|
61
|
+
return msg;
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
//---------------------------------------------------------------------------
|
|
51
65
|
// _verifyMessage()
|
|
52
66
|
//
|
|
@@ -64,7 +78,7 @@ class AqQueue {
|
|
|
64
78
|
message = {};
|
|
65
79
|
} else {
|
|
66
80
|
message = {...message};
|
|
67
|
-
if (this._isPayload(message.payload)) {
|
|
81
|
+
if (this._isJson || this._isPayload(message.payload)) {
|
|
68
82
|
payload = message.payload;
|
|
69
83
|
} else if (this._payloadTypeClass) {
|
|
70
84
|
payload = new this._payloadTypeClass(message.payload);
|
|
@@ -74,7 +88,9 @@ class AqQueue {
|
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
// validate payload
|
|
77
|
-
if (
|
|
91
|
+
if (this._isJson) {
|
|
92
|
+
message.payload = transformer.transformJsonValue(payload);
|
|
93
|
+
} else if (typeof payload === 'string') {
|
|
78
94
|
message.payload = Buffer.from(payload);
|
|
79
95
|
} else if (Buffer.isBuffer(payload)) {
|
|
80
96
|
message.payload = payload;
|
|
@@ -116,8 +132,17 @@ class AqQueue {
|
|
|
116
132
|
// Creates the queue and populates some internal attributes.
|
|
117
133
|
//---------------------------------------------------------------------------
|
|
118
134
|
async create(conn, name, options) {
|
|
119
|
-
if (options.payloadType) {
|
|
120
|
-
|
|
135
|
+
if (options.payloadType === types.DB_TYPE_JSON) {
|
|
136
|
+
this._isJson = true;
|
|
137
|
+
this._payloadType = types.DB_TYPE_JSON;
|
|
138
|
+
this._payloadTypeName = "JSON";
|
|
139
|
+
} else if (options.payloadType === undefined ||
|
|
140
|
+
options.payloadType === types.DB_TYPE_RAW) {
|
|
141
|
+
this._payloadType = types.DB_TYPE_RAW;
|
|
142
|
+
this._payloadTypeName = "RAW";
|
|
143
|
+
} else {
|
|
144
|
+
if (typeof options.payloadType === 'string') {
|
|
145
|
+
// DB Object type
|
|
121
146
|
const cls = await conn._getDbObjectClassForName(options.payloadType);
|
|
122
147
|
this._payloadTypeClass = cls;
|
|
123
148
|
options.payloadType = cls;
|
|
@@ -126,14 +151,12 @@ class AqQueue {
|
|
|
126
151
|
options.payloadType.prototype instanceof BaseDbObject, 2, "payloadType");
|
|
127
152
|
this._payloadTypeClass = options.payloadType;
|
|
128
153
|
}
|
|
129
|
-
this._payloadType =
|
|
154
|
+
this._payloadType = types.DB_TYPE_OBJECT;
|
|
130
155
|
this._payloadTypeName = this._payloadTypeClass.prototype.name;
|
|
131
|
-
} else {
|
|
132
|
-
this._payloadType = constants.DB_TYPE_RAW;
|
|
133
|
-
this._payloadTypeName = "RAW";
|
|
134
156
|
}
|
|
135
157
|
this._name = name;
|
|
136
|
-
this._impl = await conn._impl.getQueue(name,
|
|
158
|
+
this._impl = await conn._impl.getQueue(name, this._payloadTypeClass,
|
|
159
|
+
this._payloadType);
|
|
137
160
|
}
|
|
138
161
|
|
|
139
162
|
//---------------------------------------------------------------------------
|
|
@@ -147,14 +170,7 @@ class AqQueue {
|
|
|
147
170
|
errors.assertParamValue(Number.isInteger(maxMessages) && maxMessages > 0,
|
|
148
171
|
1);
|
|
149
172
|
const msgImpls = await this._impl.deqMany(maxMessages);
|
|
150
|
-
|
|
151
|
-
for (let i = 0; i < msgImpls.length; i++) {
|
|
152
|
-
const msg = new AqMessage();
|
|
153
|
-
msg._impl = msgImpls[i];
|
|
154
|
-
msg._payloadTypeClass = this._payloadTypeClass;
|
|
155
|
-
messages[i] = msg;
|
|
156
|
-
}
|
|
157
|
-
return messages;
|
|
173
|
+
return msgImpls.map(i => this._makeMessage(i));
|
|
158
174
|
}
|
|
159
175
|
|
|
160
176
|
//---------------------------------------------------------------------------
|
|
@@ -165,12 +181,8 @@ class AqQueue {
|
|
|
165
181
|
async deqOne() {
|
|
166
182
|
errors.assertArgCount(arguments, 0, 0);
|
|
167
183
|
const msgImpl = await this._impl.deqOne();
|
|
168
|
-
if (msgImpl)
|
|
169
|
-
|
|
170
|
-
msg._impl = msgImpl;
|
|
171
|
-
msg._payloadTypeClass = this._payloadTypeClass;
|
|
172
|
-
return msg;
|
|
173
|
-
}
|
|
184
|
+
if (msgImpl)
|
|
185
|
+
return this._makeMessage(msgImpl);
|
|
174
186
|
}
|
|
175
187
|
|
|
176
188
|
//---------------------------------------------------------------------------
|
|
@@ -200,7 +212,8 @@ class AqQueue {
|
|
|
200
212
|
for (let i = 0; i < messages.length; i++) {
|
|
201
213
|
verifiedMessages[i] = this._verifyMessage(messages[i]);
|
|
202
214
|
}
|
|
203
|
-
|
|
215
|
+
const msgImpls = await this._impl.enqMany(verifiedMessages);
|
|
216
|
+
return msgImpls.map(i => this._makeMessage(i));
|
|
204
217
|
}
|
|
205
218
|
|
|
206
219
|
//---------------------------------------------------------------------------
|
|
@@ -211,7 +224,8 @@ class AqQueue {
|
|
|
211
224
|
async enqOne(message) {
|
|
212
225
|
errors.assertArgCount(arguments, 1, 1);
|
|
213
226
|
message = this._verifyMessage(message);
|
|
214
|
-
|
|
227
|
+
const msgImpl = await this._impl.enqOne(message);
|
|
228
|
+
return this._makeMessage(msgImpl);
|
|
215
229
|
}
|
|
216
230
|
|
|
217
231
|
//---------------------------------------------------------------------------
|
package/lib/connection.js
CHANGED
|
@@ -1039,6 +1039,19 @@ class Connection extends EventEmitter {
|
|
|
1039
1039
|
return info;
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
+
//---------------------------------------------------------------------------
|
|
1043
|
+
// instanceName
|
|
1044
|
+
//
|
|
1045
|
+
// Returns the Oracle Database instance name associated with the connection.
|
|
1046
|
+
// This is the equivalent of the SQL expression:
|
|
1047
|
+
// sys_context('userenv', 'instance_name')
|
|
1048
|
+
//---------------------------------------------------------------------------
|
|
1049
|
+
get instanceName() {
|
|
1050
|
+
if (this._impl)
|
|
1051
|
+
return this._impl.getInstanceName();
|
|
1052
|
+
return undefined;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1042
1055
|
//---------------------------------------------------------------------------
|
|
1043
1056
|
// internalName
|
|
1044
1057
|
//
|
|
@@ -1227,7 +1240,7 @@ class Connection extends EventEmitter {
|
|
|
1227
1240
|
errors.assertArgCount(arguments, 2, 2);
|
|
1228
1241
|
errors.assertParamValue(typeof name === 'string', 1);
|
|
1229
1242
|
errors.assertParamValue(nodbUtil.isObject(options), 2);
|
|
1230
|
-
options = {...options};
|
|
1243
|
+
options = {name: name, ...options};
|
|
1231
1244
|
errors.assertParamPropUnsignedInt(options, 2, "namespace");
|
|
1232
1245
|
if (options.namespace === undefined)
|
|
1233
1246
|
options.namespace = constants.SUBSCR_NAMESPACE_DBCHANGE;
|
|
@@ -1253,14 +1266,13 @@ class Connection extends EventEmitter {
|
|
|
1253
1266
|
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
|
|
1254
1267
|
|
|
1255
1268
|
const inSubscr = _subscriptions.get(name);
|
|
1256
|
-
|
|
1269
|
+
const outValue = await this._impl.subscribe(inSubscr, options);
|
|
1257
1270
|
let subscription;
|
|
1258
1271
|
if (options.namespace === constants.SUBSCR_NAMESPACE_DBCHANGE) {
|
|
1259
1272
|
subscription = outValue.subscription;
|
|
1260
1273
|
delete outValue.subscription;
|
|
1261
1274
|
} else {
|
|
1262
1275
|
subscription = outValue;
|
|
1263
|
-
outValue = undefined;
|
|
1264
1276
|
}
|
|
1265
1277
|
_subscriptions.set(name, subscription);
|
|
1266
1278
|
return outValue;
|
package/lib/errors.js
CHANGED
|
@@ -116,7 +116,6 @@ const ERR_UNEXPECTED_DATA = 113;
|
|
|
116
116
|
const ERR_OSON_FIELD_NAME_LIMITATION = 114;
|
|
117
117
|
const ERR_ORACLE_NUMBER_NO_REPR = 115;
|
|
118
118
|
const ERR_UNSUPPORTED_VERIFIER_TYPE = 116;
|
|
119
|
-
const ERR_INVALID_PRIVATE_KEY = 117;
|
|
120
119
|
const ERR_THIN_CONNECTION_ALREADY_CREATED = 118;
|
|
121
120
|
const ERR_UNSUPPORTED_CONVERSION = 119;
|
|
122
121
|
const ERR_FETCH_TYPE_HANDLER_RETURN_VALUE = 120;
|
|
@@ -161,7 +160,8 @@ const ERR_INVALID_SID = 519;
|
|
|
161
160
|
const ERR_TNS_NAMES_FILE_MISSING = 520;
|
|
162
161
|
const ERR_CONNECTION_EOF = 521;
|
|
163
162
|
|
|
164
|
-
// define mapping for ODPI-C errors that need to be wrapped
|
|
163
|
+
// define mapping for ODPI-C, OCI & ORA errors that need to be wrapped
|
|
164
|
+
// with NJS errors
|
|
165
165
|
const adjustErrorXref = new Map();
|
|
166
166
|
adjustErrorXref.set("DPI-1010", ERR_CONNECTION_CLOSED);
|
|
167
167
|
adjustErrorXref.set("DPI-1024", [ERR_INVALID_COLL_INDEX_GET, 'at index ([0-9]+) does']);
|
|
@@ -177,7 +177,6 @@ adjustErrorXref.set("OCI-22165", [ERR_INVALID_COLL_INDEX_SET, /index \[([0-9]+)\
|
|
|
177
177
|
adjustErrorXref.set("ORA-00028", ERR_CONNECTION_CLOSED);
|
|
178
178
|
adjustErrorXref.set("ORA-00600", ERR_CONNECTION_CLOSED);
|
|
179
179
|
adjustErrorXref.set("ORA-24338", ERR_INVALID_REF_CURSOR);
|
|
180
|
-
adjustErrorXref.set("ORA-24422", ERR_POOL_HAS_BUSY_CONNECTIONS);
|
|
181
180
|
adjustErrorXref.set("ORA-25708", ERR_TOKEN_HAS_EXPIRED);
|
|
182
181
|
|
|
183
182
|
// define mapping for error messages
|
|
@@ -327,7 +326,7 @@ messages.set(ERR_MISSING_CREDENTIALS, // NJS-101
|
|
|
327
326
|
messages.set(ERR_UNEXPECTED_END_OF_DATA, // NJS-102
|
|
328
327
|
'unexpected end of data: want %d bytes but only %d bytes are available');
|
|
329
328
|
messages.set(ERR_UNEXPECTED_MESSAGE_TYPE, // NJS-103
|
|
330
|
-
'unexpected message type %d received');
|
|
329
|
+
'unexpected message type %d received at position %d of packet %d');
|
|
331
330
|
messages.set(ERR_POOL_HAS_BUSY_CONNECTIONS, // NJS-104
|
|
332
331
|
'connection pool cannot be closed because connections are busy');
|
|
333
332
|
messages.set(ERR_NAN_VALUE, // NJS-105
|
|
@@ -343,9 +342,9 @@ messages.set(ERR_INVALID_TYPE_NUM, // NJS-109
|
|
|
343
342
|
messages.set(ERR_INVALID_ORACLE_TYPE_NUM, // NJS-110
|
|
344
343
|
'invalid Oracle type number %d [csfrm: %d]');
|
|
345
344
|
messages.set(ERR_UNEXPECTED_NEGATIVE_INTEGER, // NJS-111
|
|
346
|
-
'internal error: read a negative integer when expecting a positive integer');
|
|
345
|
+
'internal error: read a negative integer when expecting a positive integer at position %d of packet %d');
|
|
347
346
|
messages.set(ERR_INTEGER_TOO_LARGE, // NJS-112
|
|
348
|
-
'internal error: read integer of length %d when expecting integer of no more than length %d');
|
|
347
|
+
'internal error: read integer of length %d when expecting integer of no more than length %d at position %d of packet %d');
|
|
349
348
|
messages.set(ERR_UNEXPECTED_DATA, // NJS-113
|
|
350
349
|
'unexpected data received: %s');
|
|
351
350
|
messages.set(ERR_OSON_FIELD_NAME_LIMITATION, // NJS-114
|
|
@@ -354,8 +353,6 @@ messages.set(ERR_ORACLE_NUMBER_NO_REPR, // NJS-115
|
|
|
354
353
|
'value cannot be represented as an Oracle Database number');
|
|
355
354
|
messages.set(ERR_UNSUPPORTED_VERIFIER_TYPE, // NJS-116
|
|
356
355
|
'password verifier type 0x%s is not supported by node-oracledb in Thin mode');
|
|
357
|
-
messages.set(ERR_INVALID_PRIVATE_KEY, // NJS-117
|
|
358
|
-
'invalid private key. Headers and footers are not allowed');
|
|
359
356
|
messages.set(ERR_THIN_CONNECTION_ALREADY_CREATED, // NJS-118
|
|
360
357
|
'node-oracledb Thick mode cannot be enabled because a Thin mode connection has already been created');
|
|
361
358
|
messages.set(ERR_UNSUPPORTED_CONVERSION, // NJS-119
|
|
@@ -611,10 +608,19 @@ function transformErr(err, fnOpt) {
|
|
|
611
608
|
const pos = err.message.indexOf(":");
|
|
612
609
|
if (pos > 0) {
|
|
613
610
|
err.code = err.message.substr(0, pos);
|
|
611
|
+
/* add Oracle Database Error Help Portal URL for database error
|
|
612
|
+
messages, but only in thin mode since this is done
|
|
613
|
+
automatically in thick mode with Oracle Client 23c and higher
|
|
614
|
+
*/
|
|
615
|
+
const settings = require('./settings.js');
|
|
616
|
+
if (err.errorNum && settings.thin) {
|
|
617
|
+
err.message += '\n' + 'Help: https://docs.oracle.com/error-help/db/ora-' +
|
|
618
|
+
`${err.errorNum.toString().padStart(5, '0')}/`;
|
|
619
|
+
}
|
|
614
620
|
if (adjustErrorXref.has(err.code)) {
|
|
615
621
|
let args = [];
|
|
616
622
|
let driverErrorNum;
|
|
617
|
-
|
|
623
|
+
const driverErrorInfo = adjustErrorXref.get(err.code);
|
|
618
624
|
if (typeof driverErrorInfo === 'number') {
|
|
619
625
|
driverErrorNum = driverErrorInfo;
|
|
620
626
|
} else {
|
|
@@ -747,7 +753,6 @@ module.exports = {
|
|
|
747
753
|
ERR_UNEXPECTED_DATA,
|
|
748
754
|
ERR_OSON_FIELD_NAME_LIMITATION,
|
|
749
755
|
ERR_OSON_VERSION_NOT_SUPPORTED,
|
|
750
|
-
ERR_INVALID_PRIVATE_KEY,
|
|
751
756
|
ERR_THIN_CONNECTION_ALREADY_CREATED,
|
|
752
757
|
ERR_UNSUPPORTED_CONVERSION,
|
|
753
758
|
ERR_FETCH_TYPE_HANDLER_RETURN_VALUE,
|
package/lib/impl/connection.js
CHANGED
|
@@ -226,6 +226,15 @@ class ConnectionImpl {
|
|
|
226
226
|
errors.throwNotImplemented("getting the external name");
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
//---------------------------------------------------------------------------
|
|
230
|
+
// getInstanceName()
|
|
231
|
+
//
|
|
232
|
+
// Returns the Oracle Database instance name associated with the connection.
|
|
233
|
+
//---------------------------------------------------------------------------
|
|
234
|
+
getInstanceName() {
|
|
235
|
+
errors.throwNotImplemented("getting the Oracle Database instance name.");
|
|
236
|
+
}
|
|
237
|
+
|
|
229
238
|
//---------------------------------------------------------------------------
|
|
230
239
|
// getInternalName()
|
|
231
240
|
//
|
package/lib/impl/resultset.js
CHANGED
|
@@ -111,14 +111,17 @@ class ResultSetImpl {
|
|
|
111
111
|
if (metadata.dbType === types.DB_TYPE_NUMBER &&
|
|
112
112
|
metadata.fetchType === types.DB_TYPE_NUMBER) {
|
|
113
113
|
converter = (v) => (v === null) ? null : parseFloat(v);
|
|
114
|
-
} else if (metadata.fetchType === types.DB_TYPE_VARCHAR
|
|
115
|
-
|
|
114
|
+
} else if (metadata.fetchType === types.DB_TYPE_VARCHAR) {
|
|
115
|
+
if (metadata.dbType === types.DB_TYPE_BINARY_DOUBLE ||
|
|
116
116
|
metadata.dbType === types.DB_TYPE_BINARY_FLOAT ||
|
|
117
117
|
metadata.dbType === types.DB_TYPE_DATE ||
|
|
118
118
|
metadata.dbType === types.DB_TYPE_TIMESTAMP ||
|
|
119
119
|
metadata.dbType === types.DB_TYPE_TIMESTAMP_LTZ ||
|
|
120
|
-
metadata.dbType === types.DB_TYPE_TIMESTAMP_TZ)
|
|
121
|
-
|
|
120
|
+
metadata.dbType === types.DB_TYPE_TIMESTAMP_TZ) {
|
|
121
|
+
converter = (v) => (v === null) ? null : v.toString();
|
|
122
|
+
} else if (metadata.dbType === types.DB_TYPE_RAW) {
|
|
123
|
+
converter = (v) => (v === null) ? null : v.toString('hex').toUpperCase();
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
if (userConverter && converter) {
|
|
124
127
|
const internalConverter = converter;
|
package/lib/oracledb.js
CHANGED
|
@@ -67,7 +67,6 @@ const defaultPoolAlias = 'default';
|
|
|
67
67
|
|
|
68
68
|
// save arguments for call to initOracleClient()
|
|
69
69
|
let _initOracleClientArgs;
|
|
70
|
-
let _thinDriverInitialized = false;
|
|
71
70
|
|
|
72
71
|
// Load the Oracledb binary
|
|
73
72
|
function _initCLib() {
|
|
@@ -248,6 +247,12 @@ async function _verifyOptions(options, inCreatePool) {
|
|
|
248
247
|
outOptions.sslServerDNMatch = options.sslServerDNMatch;
|
|
249
248
|
}
|
|
250
249
|
|
|
250
|
+
// sslAllowWeakDNMatch must be a boolean
|
|
251
|
+
if (options.sslAllowWeakDNMatch !== undefined) {
|
|
252
|
+
errors.assertParamPropValue(typeof options.sslAllowWeakDNMatch === 'boolean',
|
|
253
|
+
1, "sslAllowWeakDNMatch");
|
|
254
|
+
outOptions.sslAllowWeakDNMatch = options.sslAllowWeakDNMatch;
|
|
255
|
+
}
|
|
251
256
|
// httpsProxy must be a string
|
|
252
257
|
if (options.httpsProxy !== undefined) {
|
|
253
258
|
errors.assertParamPropValue(typeof options.httpsProxy === 'string',
|
|
@@ -472,8 +477,10 @@ async function _verifyOptions(options, inCreatePool) {
|
|
|
472
477
|
errors.assert(nodbUtil.isTokenValid(accessToken),
|
|
473
478
|
errors.ERR_TOKEN_HAS_EXPIRED);
|
|
474
479
|
if (accessToken.privateKey !== undefined) {
|
|
475
|
-
errors.assert(
|
|
476
|
-
|
|
480
|
+
errors.assert(typeof accessToken.privateKey === 'string', errors.ERR_TOKEN_BASED_AUTH);
|
|
481
|
+
accessToken.privateKey = accessToken.privateKey.replace(/\n/g, '');
|
|
482
|
+
accessToken.privateKey = accessToken.privateKey.replace('-----BEGIN PRIVATE KEY-----', '');
|
|
483
|
+
accessToken.privateKey = accessToken.privateKey.replace('-----END PRIVATE KEY-----', '');
|
|
477
484
|
}
|
|
478
485
|
|
|
479
486
|
// store token and privatekey
|
|
@@ -546,7 +553,7 @@ async function createPool(options) {
|
|
|
546
553
|
}
|
|
547
554
|
|
|
548
555
|
// initialize the Oracle client, if necessary
|
|
549
|
-
if (_initOracleClientArgs === undefined && !
|
|
556
|
+
if (_initOracleClientArgs === undefined && !settings.thinDriverInitialized) {
|
|
550
557
|
_initializeThinDriver();
|
|
551
558
|
}
|
|
552
559
|
|
|
@@ -579,6 +586,9 @@ async function createPool(options) {
|
|
|
579
586
|
delete poolCache[pool.poolAlias];
|
|
580
587
|
}
|
|
581
588
|
});
|
|
589
|
+
if (_initOracleClientArgs === undefined) {
|
|
590
|
+
settings.thinDriverInitialized = true;
|
|
591
|
+
}
|
|
582
592
|
|
|
583
593
|
return pool;
|
|
584
594
|
}
|
|
@@ -638,7 +648,6 @@ async function getConnection(a1) {
|
|
|
638
648
|
// Returns a pool for the given alias.
|
|
639
649
|
//-----------------------------------------------------------------------------
|
|
640
650
|
function getPool(poolAlias) {
|
|
641
|
-
let pool;
|
|
642
651
|
|
|
643
652
|
errors.assertArgCount(arguments, 0, 1);
|
|
644
653
|
|
|
@@ -649,7 +658,7 @@ function getPool(poolAlias) {
|
|
|
649
658
|
|
|
650
659
|
poolAlias = poolAlias || defaultPoolAlias;
|
|
651
660
|
|
|
652
|
-
pool = poolCache[poolAlias];
|
|
661
|
+
const pool = poolCache[poolAlias];
|
|
653
662
|
|
|
654
663
|
if (!pool) {
|
|
655
664
|
errors.throwErr(errors.ERR_POOL_WITH_ALIAS_NOT_FOUND, poolAlias);
|
|
@@ -1053,16 +1062,10 @@ module.exports = {
|
|
|
1053
1062
|
},
|
|
1054
1063
|
|
|
1055
1064
|
get oracleClientVersion() {
|
|
1056
|
-
if (_initOracleClientArgs === undefined) {
|
|
1057
|
-
errors.throwNotImplemented("getting the Oracle Client version");
|
|
1058
|
-
}
|
|
1059
1065
|
return settings.oracleClientVersion;
|
|
1060
1066
|
},
|
|
1061
1067
|
|
|
1062
1068
|
get oracleClientVersionString() {
|
|
1063
|
-
if (_initOracleClientArgs === undefined) {
|
|
1064
|
-
errors.throwNotImplemented("getting the Oracle Client version");
|
|
1065
|
-
}
|
|
1066
1069
|
return settings.oracleClientVersionString;
|
|
1067
1070
|
},
|
|
1068
1071
|
|
package/lib/pool.js
CHANGED
|
@@ -47,6 +47,7 @@ class Pool extends EventEmitter {
|
|
|
47
47
|
this._timeOfReset = this._createdDate = Date.now();
|
|
48
48
|
this._sessionCallback = undefined;
|
|
49
49
|
this._connRequestQueue = [];
|
|
50
|
+
this._connectionClass = settings.connectionClass;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
//---------------------------------------------------------------------------
|
|
@@ -278,8 +279,14 @@ class Pool extends EventEmitter {
|
|
|
278
279
|
});
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
// if any connections are still out and the pool is not being force closed,
|
|
283
|
+
// throw an exception
|
|
284
|
+
if (!forceClose && this._connectionsOut > 0) {
|
|
285
|
+
errors.throwErr(errors.ERR_POOL_HAS_BUSY_CONNECTIONS);
|
|
286
|
+
}
|
|
287
|
+
|
|
281
288
|
// close the pool
|
|
282
|
-
await this._impl.close(
|
|
289
|
+
await this._impl.close();
|
|
283
290
|
this._status = constants.POOL_STATUS_CLOSED;
|
|
284
291
|
this.emit('_afterPoolClose');
|
|
285
292
|
|
|
@@ -376,7 +383,9 @@ class Pool extends EventEmitter {
|
|
|
376
383
|
errors.assertParamValue(nodbUtil.isObject(a1), 1);
|
|
377
384
|
options = this._verifyGetConnectionOptions(a1);
|
|
378
385
|
}
|
|
379
|
-
|
|
386
|
+
|
|
387
|
+
// get connection class value from pool
|
|
388
|
+
options.connectionClass = this._connectionClass;
|
|
380
389
|
|
|
381
390
|
// if pool is draining/closed, throw an appropriate error
|
|
382
391
|
this._checkPoolOpen(true);
|
package/lib/settings.js
CHANGED
|
@@ -69,7 +69,7 @@ class Settings {
|
|
|
69
69
|
// database are returned as though they used the JavaScript time zone
|
|
70
70
|
// setting. TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE data
|
|
71
71
|
// are returned in native JavaScript format (since they contain time zone
|
|
72
|
-
// information).
|
|
72
|
+
// information). This is used only in Thick mode (from node-oracledb 6.0.0).
|
|
73
73
|
//---------------------------------------------------------------------------
|
|
74
74
|
_getDateComponents(useLocal, date) {
|
|
75
75
|
if (useLocal) {
|
package/lib/sodaCollection.js
CHANGED
|
@@ -109,7 +109,7 @@ class SodaCollection {
|
|
|
109
109
|
errors.assertArgCount(arguments, 1, 1);
|
|
110
110
|
errors.assertParamValue(Array.isArray(docs) && docs.length > 0, 1);
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
const actualDocs = Array(docs.length);
|
|
113
113
|
for (let i = 0; i < docs.length; i++) {
|
|
114
114
|
actualDocs[i] = nodbUtil.verifySodaDoc(docs[i]);
|
|
115
115
|
}
|