oracledb 6.3.0 → 6.4.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/LICENSE.txt +1 -1
- package/NOTICE.txt +1 -1
- package/README.md +3 -3
- package/build/Release/oracledb-6.4.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.4.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +3 -0
- package/lib/aqQueue.js +8 -8
- package/lib/connection.js +55 -9
- package/lib/constants.js +7 -1
- package/lib/dbObject.js +72 -1
- package/lib/errors.js +27 -8
- package/lib/{thin/protocol → impl/datahandlers}/buffer.js +36 -32
- package/lib/impl/datahandlers/constants.js +105 -0
- package/lib/{thin/protocol → impl/datahandlers}/oson.js +19 -1
- package/lib/impl/datahandlers/vector.js +156 -0
- package/lib/impl/pool.js +9 -0
- package/lib/impl/resultset.js +34 -17
- package/lib/lob.js +22 -6
- package/lib/oracledb.js +24 -0
- package/lib/pool.js +10 -1
- package/lib/poolStatistics.js +3 -1
- package/lib/settings.js +30 -6
- package/lib/sodaDocCursor.js +14 -1
- package/lib/thin/connection.js +100 -144
- package/lib/thin/dbObject.js +4 -2
- package/lib/thin/lob.js +6 -6
- package/lib/thin/pool.js +22 -4
- package/lib/thin/protocol/capabilities.js +3 -1
- package/lib/thin/protocol/constants.js +20 -52
- package/lib/thin/protocol/messages/auth.js +1 -1
- package/lib/thin/protocol/messages/base.js +21 -18
- package/lib/thin/protocol/messages/dataType.js +3 -2
- package/lib/thin/protocol/messages/withData.js +38 -6
- package/lib/thin/protocol/packet.js +58 -4
- package/lib/thin/sqlnet/networkSession.js +13 -1
- package/lib/thin/statement.js +7 -7
- package/lib/thin/statementCache.js +167 -0
- package/lib/transformer.js +13 -4
- package/lib/types.js +12 -2
- package/lib/util.js +29 -0
- package/lib/version.js +2 -2
- package/package.json +1 -1
- package/build/Release/oracledb-6.3.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.3.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.3.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.3.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.3.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.3.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-win32-x64.node-buildinfo.txt +0 -1
package/LICENSE.txt
CHANGED
package/NOTICE.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2015,
|
|
1
|
+
Copyright (c) 2015, 2024, Oracle and/or its affiliates.
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# node-oracledb version 6.
|
|
1
|
+
# node-oracledb version 6.4.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.
|
|
7
|
+
Use node-oracledb 6.4.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
|
|
|
@@ -48,7 +48,7 @@ vulnerability disclosure process.
|
|
|
48
48
|
|
|
49
49
|
## License
|
|
50
50
|
|
|
51
|
-
Copyright (c) 2015,
|
|
51
|
+
Copyright (c) 2015, 2024, Oracle and/or its affiliates.
|
|
52
52
|
|
|
53
53
|
This software is dual-licensed to you under the Universal Permissive License
|
|
54
54
|
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.4.0-darwin-x64.node v18.17.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 13:53:47 GMT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.4.0-linux-arm64.node v18.19.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 15:01:23 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.4.0-linux-x64.node v16.20.2 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 14:56:18 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.4.0-win32-x64.node v18.16.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 15:35:39 GMT
|
package/examples/README.md
CHANGED
|
@@ -63,6 +63,7 @@ File Name | Description
|
|
|
63
63
|
[`aqobject.js`](aqobject.js) | Oracle Advanced Queuing (AQ) example passing an Oracle Database object
|
|
64
64
|
[`aqoptions.js`](aqoptions.js) | Oracle Advanced Queuing (AQ) example setting options and message attributes
|
|
65
65
|
[`aqraw.js`](aqraw.js) | Basic Oracle Advanced Queuing (AQ) example passing text messages
|
|
66
|
+
[`aqutil.js`](aqutil.js) | Common file to setup the user credentials for all the Advanced Queuing (AQ) examples.
|
|
66
67
|
[`blobhttp.js`](blobhttp.js) | Simple web app that streams an image
|
|
67
68
|
[`calltimeout.js`](calltimeout.js) | Shows how to cancel a SQL statement if it doesn't complete in a specified time
|
|
68
69
|
[`connect.js`](connect.js) | Basic example for creating a standalone (non-pooled) connection
|
|
@@ -112,6 +113,8 @@ File Name | Description
|
|
|
112
113
|
[`resultset2.js`](resultset2.js) | Executes a query and uses a ResultSet to fetch batches of rows with `getRows()`
|
|
113
114
|
[`resultsettoquerystream.js`](resultsettoquerystream.js) | Converts a ResultSet returned from `execute()` into a Readable Stream.
|
|
114
115
|
[`rowlimit.js`](rowlimit.js) | Shows ways to limit the number of records fetched by queries
|
|
116
|
+
[`sampleazuretokenauth.js`](sampleazuretokenauth.js) | Shows connection pooling with Azure token based authentication.
|
|
117
|
+
[`sampleocitokenauth.js`](sampleocitokenauth.js) | Shows connection pooling with OCI OAuth 2.0 token based authentication.
|
|
115
118
|
[`select1.js`](select1.js) | Executes a basic query without using a connection pool or ResultSet
|
|
116
119
|
[`select2.js`](select2.js) | Executes queries to show array and object output formats
|
|
117
120
|
[`selectgeometry.js`](selectgeometry.js) | Insert and query Oracle Spatial geometries
|
package/lib/aqQueue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2019,
|
|
1
|
+
// Copyright (c) 2019, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -169,7 +169,7 @@ class AqQueue {
|
|
|
169
169
|
errors.assertArgCount(arguments, 1, 1);
|
|
170
170
|
errors.assertParamValue(Number.isInteger(maxMessages) && maxMessages > 0,
|
|
171
171
|
1);
|
|
172
|
-
const msgImpls = await this._impl.
|
|
172
|
+
const msgImpls = await this._impl.deq(maxMessages);
|
|
173
173
|
return msgImpls.map(i => this._makeMessage(i));
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -180,9 +180,9 @@ class AqQueue {
|
|
|
180
180
|
//---------------------------------------------------------------------------
|
|
181
181
|
async deqOne() {
|
|
182
182
|
errors.assertArgCount(arguments, 0, 0);
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
return this._makeMessage(
|
|
183
|
+
const msgImpls = await this._impl.deq(1);
|
|
184
|
+
if (msgImpls)
|
|
185
|
+
return this._makeMessage(msgImpls[0]);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
//---------------------------------------------------------------------------
|
|
@@ -212,7 +212,7 @@ class AqQueue {
|
|
|
212
212
|
for (let i = 0; i < messages.length; i++) {
|
|
213
213
|
verifiedMessages[i] = this._verifyMessage(messages[i]);
|
|
214
214
|
}
|
|
215
|
-
const msgImpls = await this._impl.
|
|
215
|
+
const msgImpls = await this._impl.enq(verifiedMessages);
|
|
216
216
|
return msgImpls.map(i => this._makeMessage(i));
|
|
217
217
|
}
|
|
218
218
|
|
|
@@ -224,8 +224,8 @@ class AqQueue {
|
|
|
224
224
|
async enqOne(message) {
|
|
225
225
|
errors.assertArgCount(arguments, 1, 1);
|
|
226
226
|
message = this._verifyMessage(message);
|
|
227
|
-
const
|
|
228
|
-
return this._makeMessage(
|
|
227
|
+
const msgImpls = await this._impl.enq([message]);
|
|
228
|
+
return this._makeMessage(msgImpls[0]);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
//---------------------------------------------------------------------------
|
package/lib/connection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2016,
|
|
1
|
+
// Copyright (c) 2016, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -43,6 +43,7 @@ const constants = require('./constants.js');
|
|
|
43
43
|
const settings = require('./settings.js');
|
|
44
44
|
const transformer = require('./transformer.js');
|
|
45
45
|
const types = require('./types.js');
|
|
46
|
+
const oson = require('./impl/datahandlers/oson.js');
|
|
46
47
|
|
|
47
48
|
// global mapping of subscriptions; these cannot be tied to a particular
|
|
48
49
|
// connection or pool since subscriptions can be created with one connection
|
|
@@ -105,7 +106,10 @@ class Connection extends EventEmitter {
|
|
|
105
106
|
const cls = this._getDbObjectClass(objType.elementTypeClass);
|
|
106
107
|
objType.elementTypeClass = cls;
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
+
if (objType.isCollection) {
|
|
110
|
+
nodbUtil.addTypeProperties(objType, "elementType");
|
|
111
|
+
objType.elementTypeInfo.type = objType.elementType;
|
|
112
|
+
}
|
|
109
113
|
if (objType.attributes) {
|
|
110
114
|
const props = {};
|
|
111
115
|
for (const attr of objType.attributes) {
|
|
@@ -197,6 +201,9 @@ class Connection extends EventEmitter {
|
|
|
197
201
|
typeof value === 'string' ||
|
|
198
202
|
typeof value === 'boolean' ||
|
|
199
203
|
Array.isArray(value) ||
|
|
204
|
+
value instanceof Float32Array ||
|
|
205
|
+
value instanceof Float64Array ||
|
|
206
|
+
value instanceof Int8Array ||
|
|
200
207
|
Buffer.isBuffer(value) ||
|
|
201
208
|
util.isDate(value) ||
|
|
202
209
|
value instanceof Lob ||
|
|
@@ -833,6 +840,29 @@ class Connection extends EventEmitter {
|
|
|
833
840
|
this._impl.setECID(value);
|
|
834
841
|
}
|
|
835
842
|
|
|
843
|
+
//---------------------------------------------------------------------------
|
|
844
|
+
// decode()
|
|
845
|
+
//
|
|
846
|
+
// Decodes OSON Buffer to JS data type.
|
|
847
|
+
//---------------------------------------------------------------------------
|
|
848
|
+
decodeOSON(buf) {
|
|
849
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
850
|
+
errors.assertParamValue(Buffer.isBuffer(buf), 1);
|
|
851
|
+
const decoder = new oson.OsonDecoder(buf);
|
|
852
|
+
return decoder.decode();
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
//---------------------------------------------------------------------------
|
|
857
|
+
// encode()
|
|
858
|
+
//
|
|
859
|
+
// Encodes the JS value into OSON bytes.
|
|
860
|
+
//---------------------------------------------------------------------------
|
|
861
|
+
encodeOSON(value) {
|
|
862
|
+
const encoder = new oson.OsonEncoder();
|
|
863
|
+
return encoder.encode(transformer.transformJsonValue(value));
|
|
864
|
+
}
|
|
865
|
+
|
|
836
866
|
//---------------------------------------------------------------------------
|
|
837
867
|
// execute()
|
|
838
868
|
//
|
|
@@ -844,13 +874,24 @@ class Connection extends EventEmitter {
|
|
|
844
874
|
let options = {};
|
|
845
875
|
|
|
846
876
|
// process arguments
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
877
|
+
if (nodbUtil.isObject(sql) && typeof sql.statement === 'string') {
|
|
878
|
+
errors.assertArgCount(arguments, 1, 2);
|
|
879
|
+
if (sql.values) {
|
|
880
|
+
binds = await this._processExecuteBinds(sql.values);
|
|
881
|
+
}
|
|
882
|
+
sql = sql.statement;
|
|
883
|
+
if (arguments.length == 2) {
|
|
884
|
+
options = this._verifyExecOpts(a2, false);
|
|
885
|
+
}
|
|
886
|
+
} else {
|
|
887
|
+
errors.assertArgCount(arguments, 1, 3);
|
|
888
|
+
errors.assertParamValue(typeof sql === 'string', 1);
|
|
889
|
+
if (arguments.length >= 2) {
|
|
890
|
+
binds = await this._processExecuteBinds(a2);
|
|
891
|
+
}
|
|
892
|
+
if (arguments.length == 3) {
|
|
893
|
+
options = this._verifyExecOpts(a3, false);
|
|
894
|
+
}
|
|
854
895
|
}
|
|
855
896
|
this._addDefaultsToExecOpts(options);
|
|
856
897
|
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
|
|
@@ -946,6 +987,11 @@ class Connection extends EventEmitter {
|
|
|
946
987
|
const result = await this._impl.execute(sql, numIters, binds, options,
|
|
947
988
|
true);
|
|
948
989
|
|
|
990
|
+
// convert ORA warnings to NJS
|
|
991
|
+
if (result.warning) {
|
|
992
|
+
result.warning = errors.transformErr(result.warning);
|
|
993
|
+
}
|
|
994
|
+
|
|
949
995
|
// process output binds
|
|
950
996
|
if (result.outBinds !== undefined) {
|
|
951
997
|
for (let i = 0; i < result.outBinds.length; i++) {
|
package/lib/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -200,4 +200,10 @@ module.exports = {
|
|
|
200
200
|
// TPC/XA two-phase commit flags
|
|
201
201
|
TPC_END_NORMAL: 0,
|
|
202
202
|
TPC_END_SUSPEND: 0x00100000,
|
|
203
|
+
|
|
204
|
+
// vector types
|
|
205
|
+
VECTOR_FORMAT_FLOAT32: 2,
|
|
206
|
+
VECTOR_FORMAT_FLOAT64: 3,
|
|
207
|
+
VECTOR_FORMAT_INT8: 4,
|
|
208
|
+
|
|
203
209
|
};
|
package/lib/dbObject.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2019,
|
|
1
|
+
// Copyright (c) 2019, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -32,6 +32,48 @@ const errors = require('./errors.js');
|
|
|
32
32
|
const types = require('./types.js');
|
|
33
33
|
const util = require('util');
|
|
34
34
|
|
|
35
|
+
//---------------------------------------------------------------------------
|
|
36
|
+
// validatePropertyValue
|
|
37
|
+
//
|
|
38
|
+
// Validate the value based on metadata.
|
|
39
|
+
// For object type, metaData corresponds to the attribute which is set.
|
|
40
|
+
// For collection type, metaData corresponds to element in the collection.
|
|
41
|
+
//---------------------------------------------------------------------------
|
|
42
|
+
function validatePropertyValue(objType, metaData, value, index) {
|
|
43
|
+
let valueLen, lengthErr = false;
|
|
44
|
+
|
|
45
|
+
if (value) {
|
|
46
|
+
switch (metaData.type) {
|
|
47
|
+
case types.DB_TYPE_VARCHAR:
|
|
48
|
+
case types.DB_TYPE_NVARCHAR:
|
|
49
|
+
case types.DB_TYPE_NCHAR:
|
|
50
|
+
case types.DB_TYPE_CHAR:
|
|
51
|
+
valueLen = Buffer.byteLength(value);
|
|
52
|
+
if (valueLen > metaData.maxSize) {
|
|
53
|
+
lengthErr = true;
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
case types.DB_TYPE_RAW:
|
|
57
|
+
valueLen = value.length;
|
|
58
|
+
if (valueLen > metaData.maxSize) {
|
|
59
|
+
lengthErr = true;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (lengthErr) {
|
|
66
|
+
if (index !== undefined) {
|
|
67
|
+
errors.throwErr(errors.ERR_WRONG_LENGTH_FOR_DBOBJECT_ELEM,
|
|
68
|
+
index, objType.fqn, valueLen, metaData.maxSize);
|
|
69
|
+
} else {
|
|
70
|
+
errors.throwErr(errors.ERR_WRONG_LENGTH_FOR_DBOBJECT_ATTR,
|
|
71
|
+
metaData.name, objType.fqn, valueLen, metaData.maxSize);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
35
77
|
// define base database object class; instances of this class are never
|
|
36
78
|
// instantiated; instead, classes subclassed from this one will be
|
|
37
79
|
// instantiated; a cache of these classes are maintained on each connection
|
|
@@ -61,6 +103,7 @@ class BaseDbObject {
|
|
|
61
103
|
};
|
|
62
104
|
const options = {allowArray: false};
|
|
63
105
|
value = transformer.transformValueIn(info, value, options);
|
|
106
|
+
validatePropertyValue(this._objType, attr, value);
|
|
64
107
|
this._impl.setAttrValue(attr, value);
|
|
65
108
|
}
|
|
66
109
|
|
|
@@ -124,6 +167,13 @@ class BaseDbObject {
|
|
|
124
167
|
};
|
|
125
168
|
const options = {allowArray: false};
|
|
126
169
|
value = transformer.transformValueIn(info, value, options);
|
|
170
|
+
let index = this._impl.getLastIndex();
|
|
171
|
+
if (index) {
|
|
172
|
+
index = index + 1; // element will be appended at index + 1.
|
|
173
|
+
} else {
|
|
174
|
+
index = 0; // undefined for initial append, so set it to 0
|
|
175
|
+
}
|
|
176
|
+
validatePropertyValue(this._objType, this._objType.elementTypeInfo, value, index);
|
|
127
177
|
this._impl.append(value);
|
|
128
178
|
}
|
|
129
179
|
|
|
@@ -344,6 +394,7 @@ class BaseDbObject {
|
|
|
344
394
|
};
|
|
345
395
|
const options = {allowArray: false};
|
|
346
396
|
value = transformer.transformValueIn(info, value, options);
|
|
397
|
+
validatePropertyValue(this._objType, this._objType.elementTypeInfo, value, index);
|
|
347
398
|
this._impl.setElement(index, value);
|
|
348
399
|
}
|
|
349
400
|
|
|
@@ -388,6 +439,25 @@ class BaseDbObject {
|
|
|
388
439
|
return (this._toPojo());
|
|
389
440
|
}
|
|
390
441
|
|
|
442
|
+
//---------------------------------------------------------------------------
|
|
443
|
+
// toMap()
|
|
444
|
+
//
|
|
445
|
+
// Returns the Map object where the collection’s indexes are the keys and
|
|
446
|
+
// the elements are its values.
|
|
447
|
+
//---------------------------------------------------------------------------
|
|
448
|
+
toMap() {
|
|
449
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
450
|
+
if (!this.isCollection) {
|
|
451
|
+
errors.throwErr(errors.ERR_OBJECT_IS_NOT_A_COLLECTION,
|
|
452
|
+
this.name);
|
|
453
|
+
}
|
|
454
|
+
const result = new Map();
|
|
455
|
+
this.getKeys().forEach(element => {
|
|
456
|
+
result.set(element, this.getElement(element));
|
|
457
|
+
});
|
|
458
|
+
return result;
|
|
459
|
+
}
|
|
460
|
+
|
|
391
461
|
}
|
|
392
462
|
|
|
393
463
|
// method for transforming the error
|
|
@@ -421,6 +491,7 @@ wrapFns(BaseDbObject.prototype,
|
|
|
421
491
|
"getNextIndex",
|
|
422
492
|
"getPrevIndex",
|
|
423
493
|
"getValues",
|
|
494
|
+
"toMap",
|
|
424
495
|
"hasElement",
|
|
425
496
|
"setElement",
|
|
426
497
|
"trim"
|
package/lib/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -107,7 +107,6 @@ const ERR_POOL_HAS_BUSY_CONNECTIONS = 104;
|
|
|
107
107
|
const ERR_NAN_VALUE = 105;
|
|
108
108
|
const ERR_INTERNAL = 106;
|
|
109
109
|
const ERR_INVALID_REF_CURSOR = 107;
|
|
110
|
-
const ERR_LOB_CLOSED = 108;
|
|
111
110
|
const ERR_INVALID_TYPE_NUM = 109;
|
|
112
111
|
const ERR_INVALID_ORACLE_TYPE_NUM = 110;
|
|
113
112
|
const ERR_UNEXPECTED_NEGATIVE_INTEGER = 111;
|
|
@@ -138,6 +137,12 @@ const ERR_MISSING_BIND_VALUE = 137;
|
|
|
138
137
|
const ERR_SERVER_VERSION_NOT_SUPPORTED = 138;
|
|
139
138
|
const ERR_UNEXPECTED_XML_TYPE = 139;
|
|
140
139
|
const ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY = 140;
|
|
140
|
+
const ERR_TOO_MANY_BATCH_ERRORS = 141;
|
|
141
|
+
const ERR_WRONG_LENGTH_FOR_DBOBJECT_ATTR = 142;
|
|
142
|
+
const ERR_WRONG_LENGTH_FOR_DBOBJECT_ELEM = 143;
|
|
143
|
+
const ERR_VECTOR_FORMAT_NOT_SUPPORTED = 144;
|
|
144
|
+
const ERR_VECTOR_VERSION_NOT_SUPPORTED = 145;
|
|
145
|
+
const ERR_OBJECT_IS_NOT_A_COLLECTION = 146;
|
|
141
146
|
|
|
142
147
|
// Oracle Net layer errors start from 500
|
|
143
148
|
const ERR_CONNECTION_CLOSED = 500;
|
|
@@ -168,9 +173,8 @@ const WRN_COMPILATION_CREATE = 700;
|
|
|
168
173
|
// define mapping for ODPI-C, OCI & ORA errors that need to be wrapped
|
|
169
174
|
// with NJS errors
|
|
170
175
|
const adjustErrorXref = new Map();
|
|
171
|
-
adjustErrorXref.set("DPI-1010",
|
|
176
|
+
adjustErrorXref.set("DPI-1010", ERR_INVALID_CONNECTION);
|
|
172
177
|
adjustErrorXref.set("DPI-1024", [ERR_INVALID_COLL_INDEX_GET, 'at index ([0-9]+) does']);
|
|
173
|
-
adjustErrorXref.set("DPI-1040", ERR_LOB_CLOSED);
|
|
174
178
|
adjustErrorXref.set("DPI-1044", ERR_ORACLE_NUMBER_NO_REPR);
|
|
175
179
|
adjustErrorXref.set("DPI-1055", ERR_NAN_VALUE);
|
|
176
180
|
adjustErrorXref.set("DPI-1063", ERR_EXEC_MODE_ONLY_FOR_DML);
|
|
@@ -190,7 +194,7 @@ const messages = new Map();
|
|
|
190
194
|
messages.set(ERR_INVALID_POOL, // NJS-002
|
|
191
195
|
'invalid pool');
|
|
192
196
|
messages.set(ERR_INVALID_CONNECTION, // NJS-003
|
|
193
|
-
'invalid connection');
|
|
197
|
+
'invalid or closed connection');
|
|
194
198
|
messages.set(ERR_INVALID_PROPERTY_VALUE, // NJS-004
|
|
195
199
|
'invalid value for property "%s"');
|
|
196
200
|
messages.set(ERR_INVALID_PARAMETER_VALUE, // NJS-005
|
|
@@ -341,8 +345,6 @@ messages.set(ERR_INTERNAL, // NJS-106
|
|
|
341
345
|
'internal error: %s');
|
|
342
346
|
messages.set(ERR_INVALID_REF_CURSOR, // NJS-107
|
|
343
347
|
'invalid cursor');
|
|
344
|
-
messages.set(ERR_LOB_CLOSED, // NJS-108
|
|
345
|
-
'LOB was already closed');
|
|
346
348
|
messages.set(ERR_INVALID_TYPE_NUM, // NJS-109
|
|
347
349
|
'invalid type number %d');
|
|
348
350
|
messages.set(ERR_INVALID_ORACLE_TYPE_NUM, // NJS-110
|
|
@@ -403,6 +405,18 @@ messages.set(ERR_UNEXPECTED_XML_TYPE, // NJS-139
|
|
|
403
405
|
'unexpected XML type with flag %d');
|
|
404
406
|
messages.set(ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY, // NJS-140
|
|
405
407
|
'user name must be enclosed in [] when using external authentication with a proxy user');
|
|
408
|
+
messages.set(ERR_TOO_MANY_BATCH_ERRORS, // NJS-141
|
|
409
|
+
'the number of batch errors from executemany() exceeds 65535');
|
|
410
|
+
messages.set(ERR_WRONG_LENGTH_FOR_DBOBJECT_ATTR, // NJS-142
|
|
411
|
+
'value too large for attribute %s of object %s (actual: %d, maximum: %d)');
|
|
412
|
+
messages.set(ERR_WRONG_LENGTH_FOR_DBOBJECT_ELEM, // NJS-143
|
|
413
|
+
'value too large for element %d of object %s (actual: %d, maximum: %d)');
|
|
414
|
+
messages.set(ERR_VECTOR_FORMAT_NOT_SUPPORTED, // NJS-144
|
|
415
|
+
'VECTOR format %d is not supported');
|
|
416
|
+
messages.set(ERR_VECTOR_VERSION_NOT_SUPPORTED, // NJS-145
|
|
417
|
+
'VECTOR version %d is not supported');
|
|
418
|
+
messages.set(ERR_OBJECT_IS_NOT_A_COLLECTION, // NJS-146
|
|
419
|
+
'object %s is not a collection');
|
|
406
420
|
|
|
407
421
|
// Oracle Net layer errors
|
|
408
422
|
|
|
@@ -756,7 +770,6 @@ module.exports = {
|
|
|
756
770
|
ERR_INVALID_REF_CURSOR,
|
|
757
771
|
ERR_UNSUPPORTED_VERIFIER_TYPE,
|
|
758
772
|
ERR_NAN_VALUE,
|
|
759
|
-
ERR_LOB_CLOSED,
|
|
760
773
|
ERR_ORACLE_NUMBER_NO_REPR,
|
|
761
774
|
ERR_INVALID_SERVICE_NAME,
|
|
762
775
|
ERR_INVALID_SID,
|
|
@@ -789,6 +802,12 @@ module.exports = {
|
|
|
789
802
|
ERR_SERVER_VERSION_NOT_SUPPORTED,
|
|
790
803
|
ERR_UNEXPECTED_XML_TYPE,
|
|
791
804
|
ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY,
|
|
805
|
+
ERR_TOO_MANY_BATCH_ERRORS,
|
|
806
|
+
ERR_WRONG_LENGTH_FOR_DBOBJECT_ATTR,
|
|
807
|
+
ERR_WRONG_LENGTH_FOR_DBOBJECT_ELEM,
|
|
808
|
+
ERR_VECTOR_FORMAT_NOT_SUPPORTED,
|
|
809
|
+
ERR_VECTOR_VERSION_NOT_SUPPORTED,
|
|
810
|
+
ERR_OBJECT_IS_NOT_A_COLLECTION,
|
|
792
811
|
ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
|
|
793
812
|
WRN_COMPILATION_CREATE,
|
|
794
813
|
assert,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
const { Buffer } = require('buffer');
|
|
30
30
|
const constants = require("./constants.js");
|
|
31
31
|
const errors = require("../../errors.js");
|
|
32
|
-
const settings = require("../../settings.js");
|
|
33
32
|
const types = require("../../types.js");
|
|
33
|
+
const nodbUtil = require("../../util.js");
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Base buffer class used for managing buffered data without unnecessary
|
|
@@ -184,7 +184,7 @@ class BaseBuffer {
|
|
|
184
184
|
fseconds = Math.floor(buf.readUInt32BE(7) / (1000 * 1000));
|
|
185
185
|
}
|
|
186
186
|
const year = (buf[0] - 100) * 100 + buf[1] - 100;
|
|
187
|
-
return
|
|
187
|
+
return nodbUtil.makeDate(useLocalTime, year, buf[2], buf[3], buf[4] - 1,
|
|
188
188
|
buf[5] - 1, buf[6] - 1, fseconds, 0);
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -321,6 +321,22 @@ class BaseBuffer {
|
|
|
321
321
|
return this.parseBinaryFloat(buf);
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
//---------------------------------------------------------------------------
|
|
325
|
+
// readBinaryInteger()
|
|
326
|
+
//
|
|
327
|
+
// Reads a binary integer value from the buffer and returns a Number
|
|
328
|
+
//---------------------------------------------------------------------------
|
|
329
|
+
readBinaryInteger() {
|
|
330
|
+
const buf = this.readBytesWithLength();
|
|
331
|
+
if (!buf) {
|
|
332
|
+
return 0;
|
|
333
|
+
}
|
|
334
|
+
if (buf.length > 4) {
|
|
335
|
+
errors.throwErr(errors.ERR_INTEGER_TOO_LARGE, buf.length, 4, this.pos, this.packetNum);
|
|
336
|
+
}
|
|
337
|
+
return (buf.readIntBE(0, buf.length));
|
|
338
|
+
}
|
|
339
|
+
|
|
324
340
|
//---------------------------------------------------------------------------
|
|
325
341
|
// readBool()
|
|
326
342
|
//
|
|
@@ -617,9 +633,10 @@ class BaseBuffer {
|
|
|
617
633
|
//
|
|
618
634
|
// Writes the number in binary double format to the buffer.
|
|
619
635
|
//---------------------------------------------------------------------------
|
|
620
|
-
writeBinaryDouble(n) {
|
|
621
|
-
|
|
622
|
-
|
|
636
|
+
writeBinaryDouble(n, pos) {
|
|
637
|
+
if (!pos) {
|
|
638
|
+
pos = this.reserveBytes(8);
|
|
639
|
+
}
|
|
623
640
|
this.buf.writeDoubleBE(n, pos);
|
|
624
641
|
if ((this.buf[pos] & 0x80) === 0) {
|
|
625
642
|
this.buf[pos] |= 0x80;
|
|
@@ -641,9 +658,10 @@ class BaseBuffer {
|
|
|
641
658
|
//
|
|
642
659
|
// Writes the number in binary float format to the buffer.
|
|
643
660
|
//---------------------------------------------------------------------------
|
|
644
|
-
writeBinaryFloat(n) {
|
|
645
|
-
|
|
646
|
-
|
|
661
|
+
writeBinaryFloat(n, pos) {
|
|
662
|
+
if (!pos) {
|
|
663
|
+
pos = this.reserveBytes(4);
|
|
664
|
+
}
|
|
647
665
|
this.buf.writeFloatBE(n, pos);
|
|
648
666
|
if ((this.buf[pos] & 0x80) === 0) {
|
|
649
667
|
this.buf[pos] |= 0x80;
|
|
@@ -869,29 +887,6 @@ class BaseBuffer {
|
|
|
869
887
|
|
|
870
888
|
}
|
|
871
889
|
|
|
872
|
-
//---------------------------------------------------------------------------
|
|
873
|
-
// writeQLocator()
|
|
874
|
-
//
|
|
875
|
-
// Writes a QLocator. QLocators are always 40 bytes in length.
|
|
876
|
-
//---------------------------------------------------------------------------
|
|
877
|
-
writeQLocator(numBytes) {
|
|
878
|
-
this.writeUB4(40); // QLocator length
|
|
879
|
-
this.writeUInt8(40); // repeated length
|
|
880
|
-
this.writeUInt16BE(38); // internal length
|
|
881
|
-
this.writeUInt16BE(constants.TNS_LOB_QLOCATOR_VERSION);
|
|
882
|
-
this.writeUInt8(constants.TNS_LOB_LOC_FLAGS_VALUE_BASED |
|
|
883
|
-
constants.TNS_LOB_LOC_FLAGS_BLOB | constants.TNS_LOB_LOC_FLAGS_ABSTRACT);
|
|
884
|
-
this.writeUInt8(constants.TNS_LOB_LOC_FLAGS_INIT);
|
|
885
|
-
this.writeUInt16BE(0); // additional flags
|
|
886
|
-
this.writeUInt16BE(1); // byt1
|
|
887
|
-
this.writeUInt64BE(numBytes);
|
|
888
|
-
this.writeUInt16BE(0); // unused
|
|
889
|
-
this.writeUInt16BE(0); // csid
|
|
890
|
-
this.writeUInt16BE(0); // unused
|
|
891
|
-
this.writeUInt64BE(0); // unused
|
|
892
|
-
this.writeUInt64BE(0); // unused
|
|
893
|
-
}
|
|
894
|
-
|
|
895
890
|
//---------------------------------------------------------------------------
|
|
896
891
|
// writeStr()
|
|
897
892
|
//
|
|
@@ -984,6 +979,15 @@ class BaseBuffer {
|
|
|
984
979
|
this.buf[pos] = n;
|
|
985
980
|
}
|
|
986
981
|
|
|
982
|
+
// writeSB1()
|
|
983
|
+
//
|
|
984
|
+
// Writes an signed 8-bit integer to the buffer.
|
|
985
|
+
//---------------------------------------------------------------------------
|
|
986
|
+
writeSB1(n) {
|
|
987
|
+
const pos = this.reserveBytes(1);
|
|
988
|
+
this.buf[pos] = n;
|
|
989
|
+
}
|
|
990
|
+
|
|
987
991
|
//---------------------------------------------------------------------------
|
|
988
992
|
// writeUInt16BE()
|
|
989
993
|
//
|