oracledb 6.7.1 → 6.8.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.
Files changed (61) hide show
  1. package/LICENSE.txt +1 -1
  2. package/NOTICE.txt +1 -1
  3. package/README.md +3 -3
  4. package/build/Release/oracledb-6.8.0-darwin-arm64.node +0 -0
  5. package/build/Release/oracledb-6.8.0-darwin-arm64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.8.0-darwin-x64.node +0 -0
  7. package/build/Release/oracledb-6.8.0-darwin-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-6.8.0-js-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.8.0-linux-arm64.node +0 -0
  10. package/build/Release/oracledb-6.8.0-linux-arm64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.8.0-linux-x64.node +0 -0
  12. package/build/Release/oracledb-6.8.0-linux-x64.node-buildinfo.txt +1 -0
  13. package/build/Release/oracledb-6.8.0-win32-x64.node +0 -0
  14. package/build/Release/oracledb-6.8.0-win32-x64.node-buildinfo.txt +1 -0
  15. package/lib/connection.js +66 -2
  16. package/lib/dbObject.js +42 -10
  17. package/lib/errors.js +96 -13
  18. package/lib/impl/connection.js +15 -1
  19. package/lib/impl/datahandlers/buffer.js +92 -1
  20. package/lib/impl/datahandlers/constants.js +2 -0
  21. package/lib/impl/datahandlers/oson.js +15 -1
  22. package/lib/impl/datahandlers/vector.js +72 -27
  23. package/lib/oracledb.js +80 -4
  24. package/lib/settings.js +5 -1
  25. package/lib/thin/connection.js +13 -2
  26. package/lib/thin/dbObject.js +38 -7
  27. package/lib/thin/pool.js +7 -3
  28. package/lib/thin/protocol/capabilities.js +1 -1
  29. package/lib/thin/protocol/constants.js +2 -0
  30. package/lib/thin/protocol/messages/auth.js +29 -6
  31. package/lib/thin/protocol/messages/fastAuth.js +6 -1
  32. package/lib/thin/protocol/messages/withData.js +10 -1
  33. package/lib/thin/protocol/packet.js +1 -1
  34. package/lib/thin/sqlnet/ANO.js +438 -0
  35. package/lib/thin/sqlnet/constants.js +5 -1
  36. package/lib/thin/sqlnet/ezConnectResolver.js +4 -2
  37. package/lib/thin/sqlnet/navNodes.js +21 -2
  38. package/lib/thin/sqlnet/networkSession.js +88 -16
  39. package/lib/thin/sqlnet/ntTcp.js +50 -3
  40. package/lib/thin/sqlnet/packet.js +31 -4
  41. package/lib/thin/sqlnet/sessionAtts.js +25 -2
  42. package/lib/thin/util.js +3 -8
  43. package/lib/transformer.js +13 -2
  44. package/lib/types.js +220 -3
  45. package/lib/util.js +1 -1
  46. package/lib/version.js +3 -3
  47. package/package.json +1 -1
  48. package/plugins/token/extensionAzure/index.js +101 -0
  49. package/plugins/token/extensionOci/index.js +174 -0
  50. package/build/Release/Linux_cmds.txt +0 -972
  51. package/build/Release/oracledb-6.7.1-darwin-arm64.node +0 -0
  52. package/build/Release/oracledb-6.7.1-darwin-arm64.node-buildinfo.txt +0 -1
  53. package/build/Release/oracledb-6.7.1-darwin-x64.node +0 -0
  54. package/build/Release/oracledb-6.7.1-darwin-x64.node-buildinfo.txt +0 -1
  55. package/build/Release/oracledb-6.7.1-js-buildinfo.txt +0 -1
  56. package/build/Release/oracledb-6.7.1-linux-arm64.node +0 -0
  57. package/build/Release/oracledb-6.7.1-linux-arm64.node-buildinfo.txt +0 -1
  58. package/build/Release/oracledb-6.7.1-linux-x64.node +0 -0
  59. package/build/Release/oracledb-6.7.1-linux-x64.node-buildinfo.txt +0 -1
  60. package/build/Release/oracledb-6.7.1-win32-x64.node +0 -0
  61. package/build/Release/oracledb-6.7.1-win32-x64.node-buildinfo.txt +0 -1
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015, 2024 Oracle and/or its affiliates.
1
+ Copyright (c) 2015, 2025 Oracle and/or its affiliates.
2
2
 
3
3
  This software is dual-licensed to you under the Universal Permissive License
4
4
  (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
package/NOTICE.txt CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2015, 2024, Oracle and/or its affiliates.
1
+ Copyright (c) 2015, 2025, Oracle and/or its affiliates.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # node-oracledb version 6.7.1
1
+ # node-oracledb version 6.8.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.1 to connect Node.js 14.6, or later, to Oracle
7
+ Use node-oracledb 6.8.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, 2024, Oracle and/or its affiliates.
51
+ Copyright (c) 2015, 2025, 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
@@ -0,0 +1 @@
1
+ oracledb-6.8.0-darwin-arm64.node v22.2.0 1e47f3ef9289df6513744f8cff1ad648f989c8af 6fa744509b8144c7bd2a25a1cb1e7dd8f746d31f Wed, 12 Feb 2025 09:02:05 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.8.0-darwin-x64.node v20.11.1 1e47f3ef9289df6513744f8cff1ad648f989c8af 6fa744509b8144c7bd2a25a1cb1e7dd8f746d31f Wed, 12 Feb 2025 08:49:37 GMT
@@ -0,0 +1 @@
1
+ 1e47f3ef9289df6513744f8cff1ad648f989c8af
@@ -0,0 +1 @@
1
+ oracledb-6.8.0-linux-arm64.node v20.16.0 1e47f3ef9289df6513744f8cff1ad648f989c8af 6fa744509b8144c7bd2a25a1cb1e7dd8f746d31f Wed, 12 Feb 2025 09:53:19 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.8.0-linux-x64.node v20.16.0 1e47f3ef9289df6513744f8cff1ad648f989c8af 6fa744509b8144c7bd2a25a1cb1e7dd8f746d31f Wed, 12 Feb 2025 09:52:45 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.8.0-win32-x64.node v20.0.0 1e47f3ef9289df6513744f8cff1ad648f989c8af 6fa744509b8144c7bd2a25a1cb1e7dd8f746d31f Wed, 12 Feb 2025 09:31:59 GMT
package/lib/connection.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2016, 2024, Oracle and/or its affiliates.
1
+ // Copyright (c) 2016, 2025, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -50,6 +50,48 @@ const oson = require('./impl/datahandlers/oson.js');
50
50
  // and destroyed with another!
51
51
  const _subscriptions = new Map();
52
52
 
53
+ // default closure for NUMBER type.
54
+ const defaultNumberConverter = (v) => (v === null) ? null : parseFloat(v);
55
+
56
+ //---------------------------------------------------------------------------
57
+ // _determineDbObjTypeConverter()
58
+ //
59
+ // Determines the converter associated with each DB type and its metadata.
60
+ // This function is called once during metadata construction and the
61
+ // converters are invoked when retriving DBObject values.
62
+ //---------------------------------------------------------------------------
63
+ function _determineDbObjTypeConverter(metadata, options) {
64
+ // clear any previous converter functions that may have been
65
+ // retained
66
+ delete metadata.converter;
67
+
68
+ // If a DBfetch type handler is specified, update converter,
69
+ // if available.
70
+ if (options.dbObjectTypeHandler) {
71
+ const result = options.dbObjectTypeHandler(metadata);
72
+ if (result !== undefined) {
73
+ errors.assert(typeof result === 'object',
74
+ errors.ERR_DB_FETCH_TYPE_HANDLER_RETURN_VALUE);
75
+ if (result.converter !== undefined) {
76
+ errors.assert(typeof result.converter === 'function',
77
+ errors.ERR_DB_FETCH_TYPE_HANDLER_CONVERTER);
78
+ }
79
+ if ([types.DB_TYPE_CLOB, types.DB_TYPE_NCLOB, types.DB_TYPE_BLOB,
80
+ types.DB_TYPE_BFILE].includes(metadata.type)) {
81
+ // converters for LOB's are not supported.
82
+ return errors.throwErr(errors.ERR_NOT_IMPLEMENTED,
83
+ 'DbObjConverter for LOBs');
84
+ }
85
+ metadata.converter = result.converter;
86
+ }
87
+ }
88
+ if (metadata.type === types.DB_TYPE_NUMBER && !metadata.converter) {
89
+ // set default converter for NUMBER type as they are returned as strings
90
+ // from DB.
91
+ metadata.converter = defaultNumberConverter;
92
+ }
93
+ }
94
+
53
95
  // define class
54
96
  class Connection extends EventEmitter {
55
97
 
@@ -106,9 +148,11 @@ class Connection extends EventEmitter {
106
148
  const cls = this._getDbObjectClass(objType.elementTypeClass);
107
149
  objType.elementTypeClass = cls;
108
150
  }
151
+ const options = {dbObjectTypeHandler: settings.dbObjectTypeHandler};
109
152
  if (objType.isCollection) {
110
153
  nodbUtil.addTypeProperties(objType, "elementType");
111
154
  objType.elementTypeInfo.type = objType.elementType;
155
+ _determineDbObjTypeConverter(objType.elementTypeInfo, options);
112
156
  }
113
157
  if (objType.attributes) {
114
158
  const props = {};
@@ -126,6 +170,10 @@ class Connection extends EventEmitter {
126
170
  }
127
171
  };
128
172
  props[attr.name] = prop;
173
+
174
+ // calculate for each attribute metadata as converters might change
175
+ // based on precision, scale, maxSize,..
176
+ _determineDbObjTypeConverter(attr, options);
129
177
  }
130
178
  Object.defineProperties(DbObject.prototype, props);
131
179
  }
@@ -368,7 +416,9 @@ class Connection extends EventEmitter {
368
416
  bindInfo.type !== types.DB_TYPE_TIMESTAMP &&
369
417
  bindInfo.type !== types.DB_TYPE_TIMESTAMP_LTZ &&
370
418
  bindInfo.type !== types.DB_TYPE_TIMESTAMP_TZ &&
371
- bindInfo.type !== types.DB_TYPE_RAW) {
419
+ bindInfo.type !== types.DB_TYPE_RAW &&
420
+ bindInfo.type !== types.DB_TYPE_INTERVAL_YM &&
421
+ bindInfo.type !== types.DB_TYPE_INTERVAL_DS) {
372
422
  errors.throwErr(errors.ERR_INVALID_TYPE_FOR_ARRAY_BIND);
373
423
  }
374
424
 
@@ -1216,6 +1266,20 @@ class Connection extends EventEmitter {
1216
1266
  this._impl.isHealthy());
1217
1267
  }
1218
1268
 
1269
+ isCompressionEnabled() {
1270
+ return (this._impl && this._impl.isCompressionEnabled());
1271
+ }
1272
+
1273
+ //---------------------------------------------------------------------------
1274
+ // maxIdentifierLength
1275
+ //
1276
+ // Returns the maximum length of identifiers supported by the database to
1277
+ // which this connection has been established.
1278
+ //---------------------------------------------------------------------------
1279
+ get maxIdentifierLength() {
1280
+ return this._impl && this._impl.getMaxIdentifierLength();
1281
+ }
1282
+
1219
1283
  //---------------------------------------------------------------------------
1220
1284
  // maxOpenCursors
1221
1285
  //
package/lib/dbObject.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2019, 2024, Oracle and/or its affiliates.
1
+ // Copyright (c) 2019, 2025, Oracle and/or its affiliates.
2
2
 
3
3
  //----------------------------------------------------------------------------
4
4
  //
@@ -86,7 +86,7 @@ class BaseDbObject {
86
86
  //---------------------------------------------------------------------------
87
87
  _getAttrValue(attr) {
88
88
  const value = this._impl.getAttrValue(attr);
89
- return this._transformValueOut(value, attr.typeClass);
89
+ return this._transformValueOut(value, attr.typeClass, attr);
90
90
  }
91
91
 
92
92
  //---------------------------------------------------------------------------
@@ -138,16 +138,21 @@ class BaseDbObject {
138
138
  //
139
139
  // Transforms a value going out to the caller from the implementation.
140
140
  //---------------------------------------------------------------------------
141
- _transformValueOut(value, cls) {
141
+ _transformValueOut(value, cls, metaData) {
142
142
  let outValue = value;
143
143
  if (value instanceof impl.LobImpl) {
144
144
  outValue = new Lob();
145
145
  outValue._setup(value, true);
146
- } else if (value instanceof impl.DbObjectImpl) {
147
- outValue = Object.create(cls.prototype);
148
- outValue._impl = value;
149
- if (outValue.isCollection) {
150
- outValue = new Proxy(outValue, BaseDbObject._collectionProxyHandler);
146
+ } else {
147
+ if (value instanceof impl.DbObjectImpl) {
148
+ outValue = Object.create(cls.prototype);
149
+ outValue._impl = value;
150
+ if (outValue.isCollection) {
151
+ outValue = new Proxy(outValue, BaseDbObject._collectionProxyHandler);
152
+ }
153
+ }
154
+ if (metaData.converter) {
155
+ outValue = metaData.converter(outValue);
151
156
  }
152
157
  }
153
158
  return outValue;
@@ -202,6 +207,21 @@ class BaseDbObject {
202
207
  return this._attributes;
203
208
  }
204
209
 
210
+ //---------------------------------------------------------------------------
211
+ // copy
212
+ //
213
+ // Creates and returns a copy of the object. The copy is independent of
214
+ // the original object that was copied.
215
+ //---------------------------------------------------------------------------
216
+ copy() {
217
+ errors.assertArgCount(arguments, 0, 0);
218
+ const newObj = Object.create(this);
219
+ newObj._impl = this._impl.copy();
220
+ if (this.isCollection)
221
+ return new Proxy(newObj, BaseDbObject._collectionProxyHandler);
222
+ return newObj;
223
+ }
224
+
205
225
  //---------------------------------------------------------------------------
206
226
  // deleteElement()
207
227
  //
@@ -253,6 +273,17 @@ class BaseDbObject {
253
273
  return this._objType.fqn;
254
274
  }
255
275
 
276
+ //---------------------------------------------------------------------------
277
+ // length
278
+ //
279
+ // Length of the database object type, if it is a collection. Else it
280
+ // returns undefined.
281
+ //---------------------------------------------------------------------------
282
+ get length() {
283
+ if (this.isCollection)
284
+ return this._impl.getLength();
285
+ return undefined;
286
+ }
256
287
  //---------------------------------------------------------------------------
257
288
  // getElement()
258
289
  //
@@ -262,7 +293,7 @@ class BaseDbObject {
262
293
  errors.assertArgCount(arguments, 1, 1);
263
294
  errors.assertParamValue(Number.isInteger(index), 1);
264
295
  const value = this._impl.getElement(index);
265
- return this._transformValueOut(value, this.elementTypeClass);
296
+ return this._transformValueOut(value, this.elementTypeClass, this._objType.elementTypeInfo);
266
297
  }
267
298
 
268
299
  //---------------------------------------------------------------------------
@@ -326,7 +357,7 @@ class BaseDbObject {
326
357
  errors.assertArgCount(arguments, 0, 0);
327
358
  const values = this._impl.getValues();
328
359
  for (let i = 0; i < values.length; i++) {
329
- values[i] = this._transformValueOut(values[i], this.elementTypeClass);
360
+ values[i] = this._transformValueOut(values[i], this.elementTypeClass, this._objType.elementTypeInfo);
330
361
  }
331
362
  return values;
332
363
  }
@@ -483,6 +514,7 @@ wrapFns(BaseDbObject.prototype,
483
514
  "_getAttrValue",
484
515
  "_setAttrValue",
485
516
  "append",
517
+ "copy",
486
518
  "deleteElement",
487
519
  "getElement",
488
520
  "getKeys",
package/lib/errors.js CHANGED
@@ -1,5 +1,4 @@
1
- // Copyright (c) 2022, 2024, Oracle and/or its affiliates.
2
-
1
+ // Copyright (c) 2022, 2025, Oracle and/or its affiliates.
3
2
  //-----------------------------------------------------------------------------
4
3
  //
5
4
  // This software is dual-licensed to you under the Universal Permissive License
@@ -164,6 +163,18 @@ const ERR_INVALID_BRANCH_SIZE = 154;
164
163
  const ERR_OPERATION_NOT_SUPPORTED_ON_BFILE = 155;
165
164
  const ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE = 156;
166
165
  const ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES = 157;
166
+ const ERR_VECTOR_SPARSE_INDICES_IS_NOT_ARRAY = 158;
167
+ const ERR_VECTOR_SPARSE_VALUES_IS_NOT_ARRAY = 159;
168
+ const ERR_VECTOR_SPARSE_DIMS_IS_NOT_INTEGER = 160;
169
+ const ERR_VECTOR_SPARSE_INDICES_VALUES_NOT_EQUAL = 161;
170
+ const ERR_VECTOR_SPARSE_INVALID_JSON = 162;
171
+ const ERR_VECTOR_SPARSE_INVALID_STRING = 163;
172
+ const ERR_VECTOR_SPARSE_INVALID_INPUT = 164;
173
+ const ERR_VECTOR_SPARSE_INDICES_ELEM_IS_NOT_VALID = 165;
174
+ const ERR_DB_FETCH_TYPE_HANDLER_CONVERTER = 166;
175
+ const ERR_DB_FETCH_TYPE_HANDLER_RETURN_VALUE = 167;
176
+ const ERR_ACCESS_TOKEN = 168;
177
+ const ERR_CALLOUT_FN = 169;
167
178
 
168
179
  // Oracle Net layer errors start from 500
169
180
  const ERR_CONNECTION_CLOSED = 500;
@@ -196,6 +207,10 @@ const ERR_AZURE_VAULT_AUTH_FAILED = 527;
196
207
  const ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED = 528;
197
208
  const ERR_WALLET_TYPE_NOT_SUPPORTED = 529;
198
209
  const ERR_HOST_NOT_FOUND = 530;
210
+ const ERR_ANO_PACKET = 531;
211
+ const ERR_ANO_STATUS = 532;
212
+ const ERR_ANO_NEGOTIATION = 533;
213
+ const ERR_DATA_COMPRESSION = 534;
199
214
 
200
215
  // Oracle SUCCESS_WITH_INFO warning start from 700
201
216
  const WRN_COMPILATION_CREATE = 700;
@@ -416,7 +431,7 @@ messages.set(ERR_INVALID_OBJECT_TYPE_NAME, // NJS-129
416
431
  messages.set(ERR_TDS_TYPE_NOT_SUPPORTED, // NJS-130
417
432
  'Oracle TDS data type %d is not supported');
418
433
  messages.set(ERR_INVALID_COLL_INDEX_SET, // NJS-131
419
- 'given index %d must be in the range of %d to %d');
434
+ 'given index [%d] must be in the range of [%d] to [%d]');
420
435
  messages.set(ERR_INVALID_COLL_INDEX_GET, // NJS-132
421
436
  'element at index %d does not exist');
422
437
  messages.set(ERR_DELETE_ELEMENTS_OF_VARRAY, // NJS-133
@@ -467,6 +482,30 @@ messages.set(ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE, // NJS-156
467
482
  'operation is only supported on BFILE LOBs');
468
483
  messages.set(ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES, // NJS-157
469
484
  'executeMany() cannot be used with SELECT statement or WITH SQL clause');
485
+ messages.set(ERR_VECTOR_SPARSE_INDICES_IS_NOT_ARRAY, // NJS-158
486
+ 'SPARSE VECTOR indices is not Uint32Array or an Array');
487
+ messages.set(ERR_VECTOR_SPARSE_VALUES_IS_NOT_ARRAY, // NJS-159
488
+ 'SPARSE VECTOR values is not an Array');
489
+ messages.set(ERR_VECTOR_SPARSE_DIMS_IS_NOT_INTEGER, // NJS-160
490
+ 'SPARSE VECTOR dimensions is not an Positive Integer');
491
+ messages.set(ERR_VECTOR_SPARSE_INDICES_VALUES_NOT_EQUAL, // NJS-161
492
+ 'SPARSE VECTOR indices and values must be of same length');
493
+ messages.set(ERR_VECTOR_SPARSE_INVALID_JSON, // NJS-162
494
+ 'SPARSE VECTOR string data is not valid JSON');
495
+ messages.set(ERR_VECTOR_SPARSE_INVALID_STRING, // NJS-163
496
+ 'SPARSE VECTOR string data Array should have exactly 3 elements');
497
+ messages.set(ERR_VECTOR_SPARSE_INVALID_INPUT, // NJS-164
498
+ 'SPARSE VECTOR Invalid Input Data');
499
+ messages.set(ERR_VECTOR_SPARSE_INDICES_ELEM_IS_NOT_VALID, // NJS-165
500
+ 'SPARSE VECTOR indices element at index %d is not valid');
501
+ messages.set(ERR_DB_FETCH_TYPE_HANDLER_CONVERTER, // NJS-166
502
+ 'DBFetchTypeHandler return value attribute "converter" must be a function');
503
+ messages.set(ERR_DB_FETCH_TYPE_HANDLER_RETURN_VALUE, // NJS-167
504
+ 'DBFetchTypeHandler return value must be an object');
505
+ messages.set(ERR_ACCESS_TOKEN, // NJS-168
506
+ 'access token function failed.');
507
+ messages.set(ERR_CALLOUT_FN, // NJS-169
508
+ 'External function call failed.');
470
509
 
471
510
  // Oracle Net layer errors
472
511
 
@@ -516,23 +555,29 @@ messages.set(ERR_AZURE_CONFIG_PROVIDER_AUTH_FAILED, // NJS-522
516
555
  'Azure Authentication Failed: The authentication parameter value %s may be incorrect');
517
556
  messages.set(ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG, // NJS-523
518
557
  'Failed to retrieve configuration from Centralized Configuration Provider:\n %s');
519
- messages.set(ERR_CONFIG_PROVIDER_NOT_SUPPORTED, // NJS-524
558
+ messages.set(ERR_CONFIG_PROVIDER_NOT_SUPPORTED, // NJS-524
520
559
  'Configuration Provider not supported: %s');
521
- messages.set(ERR_CONFIG_PROVIDER_LOAD_FAILED, // NJS-525
560
+ messages.set(ERR_CONFIG_PROVIDER_LOAD_FAILED, // NJS-525
522
561
  'Centralized Config Provider failed to load required libraries. Please install the required libraries.\n %s');
523
- messages.set(ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED, // NJS-526
562
+ messages.set(ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED, // NJS-526
524
563
  'OCI authentication failed: The authentication parameter value %s may be incorrect');
525
- messages.set(ERR_AZURE_VAULT_AUTH_FAILED, // NJS-527
564
+ messages.set(ERR_AZURE_VAULT_AUTH_FAILED, // NJS-527
526
565
  'Azure Vault: Provide correct Azure Vault authentication details');
527
- messages.set(ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED, // NJS-528
566
+ messages.set(ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED, // NJS-528
528
567
  'Azure service principal authentication requires either a client certificate path or a client secret string');
529
- messages.set(ERR_WALLET_TYPE_NOT_SUPPORTED, // NJS-529
568
+ messages.set(ERR_WALLET_TYPE_NOT_SUPPORTED, // NJS-529
530
569
  'Invalid wallet content format. Supported format is PEM');
531
- messages.set(ERR_HOST_NOT_FOUND, // NJS-530
570
+ messages.set(ERR_HOST_NOT_FOUND, // NJS-530
532
571
  'The host addresses or URLs provided by the connect string are incorrect or unresolvable in your network.');
533
-
572
+ messages.set(ERR_ANO_PACKET, // NJS-531
573
+ 'Error in Advanced Networking Option packet received from the server');
574
+ messages.set(ERR_ANO_STATUS, // NJS-532
575
+ '%s service recieved status failure');
576
+ messages.set(ERR_ANO_NEGOTIATION, // NJS-533
577
+ 'Advanced Networking Option service negotiation failed. Native Network Encryption and DataIntegrity only supported in node-oracledb thick mode.\nCause: ORA-%s');
578
+ messages.set(ERR_DATA_COMPRESSION, 'Error during data compression/decompression: %s\n'); //NJS-534
534
579
  // Oracle SUCCESS_WITH_INFO warning
535
- messages.set(WRN_COMPILATION_CREATE, // NJS-700
580
+ messages.set(WRN_COMPILATION_CREATE, // NJS-700
536
581
  'creation succeeded with compilation errors');
537
582
 
538
583
  //-----------------------------------------------------------------------------
@@ -697,6 +742,14 @@ function throwErr() {
697
742
  throw (getErr(...arguments));
698
743
  }
699
744
 
745
+ function throwErrWithORAError() {
746
+ const err = (getErr(...arguments));
747
+ const pos = err.message.indexOf("ORA-");
748
+ const oraError = err.message.substring(pos + 4, pos + 9);
749
+ err.message = err.message + '\nHelp: https://docs.oracle.com/error-help/db/ora-' + oraError;
750
+ throw err;
751
+ }
752
+
700
753
  //-----------------------------------------------------------------------------
701
754
  // throwNotImplemented()
702
755
  //
@@ -706,6 +759,7 @@ function throwNotImplemented(feature) {
706
759
  throwErr(ERR_NOT_IMPLEMENTED, feature);
707
760
  }
708
761
 
762
+
709
763
  //-----------------------------------------------------------------------------
710
764
  // transformErr()
711
765
  //
@@ -754,6 +808,17 @@ function transformErr(err, fnOpt) {
754
808
  return err;
755
809
  }
756
810
 
811
+ //-----------------------------------------------------------------------------
812
+ // throwWrapErr()
813
+ //
814
+ // Throws error by wrapping exceptions with a specific error.
815
+ //-----------------------------------------------------------------------------
816
+ function throwWrapErr(err, fnOpt) {
817
+ const newErr = getErr(fnOpt);
818
+ newErr.stack = err.stack;
819
+ throw newErr;
820
+ }
821
+
757
822
  // define exports
758
823
  module.exports = {
759
824
  ERR_INTEGRITY_ERROR_CODES,
@@ -846,8 +911,12 @@ module.exports = {
846
911
  ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG,
847
912
  ERR_CONFIG_PROVIDER_NOT_SUPPORTED,
848
913
  ERR_CONFIG_PROVIDER_LOAD_FAILED,
914
+ ERR_DATA_COMPRESSION,
849
915
  ERR_WALLET_TYPE_NOT_SUPPORTED,
850
916
  ERR_HOST_NOT_FOUND,
917
+ ERR_ANO_PACKET,
918
+ ERR_ANO_STATUS,
919
+ ERR_ANO_NEGOTIATION,
851
920
  ERR_INVALID_BIND_NAME,
852
921
  ERR_WRONG_NUMBER_OF_BINDS,
853
922
  ERR_BUFFER_LENGTH_INSUFFICIENT,
@@ -909,6 +978,18 @@ module.exports = {
909
978
  ERR_OPERATION_NOT_SUPPORTED_ON_BFILE,
910
979
  ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE,
911
980
  ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES,
981
+ ERR_VECTOR_SPARSE_INDICES_IS_NOT_ARRAY,
982
+ ERR_VECTOR_SPARSE_VALUES_IS_NOT_ARRAY,
983
+ ERR_VECTOR_SPARSE_DIMS_IS_NOT_INTEGER,
984
+ ERR_VECTOR_SPARSE_INDICES_VALUES_NOT_EQUAL,
985
+ ERR_VECTOR_SPARSE_INVALID_JSON,
986
+ ERR_VECTOR_SPARSE_INVALID_STRING,
987
+ ERR_VECTOR_SPARSE_INVALID_INPUT,
988
+ ERR_VECTOR_SPARSE_INDICES_ELEM_IS_NOT_VALID,
989
+ ERR_DB_FETCH_TYPE_HANDLER_CONVERTER,
990
+ ERR_DB_FETCH_TYPE_HANDLER_RETURN_VALUE,
991
+ ERR_ACCESS_TOKEN,
992
+ ERR_CALLOUT_FN,
912
993
  WRN_COMPILATION_CREATE,
913
994
  assert,
914
995
  assertArgCount,
@@ -923,6 +1004,8 @@ module.exports = {
923
1004
  assertPropValue,
924
1005
  getErr,
925
1006
  throwErr,
1007
+ throwErrWithORAError,
926
1008
  throwNotImplemented,
927
- transformErr
1009
+ transformErr,
1010
+ throwWrapErr
928
1011
  };
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2022, 2025, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -289,6 +289,16 @@ class ConnectionImpl {
289
289
  errors.throwNotImplemented("getting the internal name");
290
290
  }
291
291
 
292
+ //---------------------------------------------------------------------------
293
+ // getMaxIdentifierLength()
294
+ //
295
+ // Returns the maximum length of identifiers supported by the database to
296
+ // which this connection has been established.
297
+ //---------------------------------------------------------------------------
298
+ getMaxIdentifierLength() {
299
+ errors.throwNotImplemented("getting the maximum identifier length");
300
+ }
301
+
292
302
  //---------------------------------------------------------------------------
293
303
  // getMaxOpenCursors()
294
304
  //
@@ -399,6 +409,10 @@ class ConnectionImpl {
399
409
  errors.throwNotImplemented("getting the health of the connection");
400
410
  }
401
411
 
412
+ isCompressionEnabled() {
413
+ errors.throwNotImplemented("getting the data compression status on the connection");
414
+ }
415
+
402
416
  //---------------------------------------------------------------------------
403
417
  // ping()
404
418
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1
+ // Copyright (c) 2022, 2025, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -188,6 +188,36 @@ class BaseBuffer {
188
188
  buf[5] - 1, buf[6] - 1, fseconds, 0);
189
189
  }
190
190
 
191
+ //---------------------------------------------------------------------------
192
+ // parseOracleIntervalYM()
193
+ //
194
+ // Parses an Oracle interval year-to-month (YM) from the supplied buffer
195
+ // and returns a corresponding IntervalYM object representing that value.
196
+ // This object contains attributes for years and months.
197
+ //---------------------------------------------------------------------------
198
+ parseOracleIntervalYM(buf) {
199
+ const years = buf.readUInt32BE() - constants.TNS_DURATION_MID;
200
+ const months = buf[4] - constants.TNS_DURATION_OFFSET;
201
+ return new types.IntervalYM({ years: years, months: months });
202
+ }
203
+
204
+ //---------------------------------------------------------------------------
205
+ // parseOracleIntervalDS()
206
+ //
207
+ // Parses an Oracle interval day-to-second (DS) from the supplied buffer
208
+ // and returns a corresponding IntervalDS object representing that value.
209
+ // This object contains attributes for day and time units.
210
+ //---------------------------------------------------------------------------
211
+ parseOracleIntervalDS(buf) {
212
+ const days = buf.readUInt32BE() - constants.TNS_DURATION_MID;
213
+ const fseconds = buf.readUInt32BE(7) - constants.TNS_DURATION_MID;
214
+ const hours = buf[4] - constants.TNS_DURATION_OFFSET;
215
+ const minutes = buf[5] - constants.TNS_DURATION_OFFSET;
216
+ const seconds = buf[6] - constants.TNS_DURATION_OFFSET;
217
+ return new types.IntervalDS({ days: days, hours: hours, minutes: minutes,
218
+ seconds: seconds, fseconds: fseconds });
219
+ }
220
+
191
221
  //---------------------------------------------------------------------------
192
222
  // parseOracleNumber()
193
223
  //
@@ -430,6 +460,34 @@ class BaseBuffer {
430
460
  return this.parseOracleDate(buf, useLocalTime);
431
461
  }
432
462
 
463
+ //---------------------------------------------------------------------------
464
+ // readOracleIntervalYM()
465
+ //
466
+ // Reads interval year to month value from the buffer and returns a
467
+ // JavaScript object representing that value.
468
+ //---------------------------------------------------------------------------
469
+ readOracleIntervalYM() {
470
+ const buf = this.readBytesWithLength();
471
+ if (!buf) {
472
+ return null;
473
+ }
474
+ return this.parseOracleIntervalYM(buf);
475
+ }
476
+
477
+ //---------------------------------------------------------------------------
478
+ // readOracleIntervalDS()
479
+ //
480
+ // Reads interval day to second value from the buffer and returns a
481
+ // JavaScript object representing that value.
482
+ //---------------------------------------------------------------------------
483
+ readOracleIntervalDS() {
484
+ const buf = this.readBytesWithLength();
485
+ if (!buf) {
486
+ return null;
487
+ }
488
+ return this.parseOracleIntervalDS(buf);
489
+ }
490
+
433
491
  //---------------------------------------------------------------------------
434
492
  // readOracleNumber()
435
493
  //
@@ -801,6 +859,39 @@ class BaseBuffer {
801
859
  }
802
860
  }
803
861
 
862
+ //---------------------------------------------------------------------------
863
+ // writeOracleIntervalYM()
864
+ //
865
+ // Writes a time interval to the buffer in Oracle Interval Year To Month
866
+ // format. It is assumed that the 'value' parameter is a valid IntervalYM
867
+ // object at this stage.
868
+ //---------------------------------------------------------------------------
869
+ writeOracleIntervalYM(value, writeLength = true) {
870
+ if (writeLength) {
871
+ this.writeUInt8(5);
872
+ }
873
+ this.writeUInt32BE(value.years + constants.TNS_DURATION_MID);
874
+ this.writeUInt8(value.months + constants.TNS_DURATION_OFFSET);
875
+ }
876
+
877
+ //---------------------------------------------------------------------------
878
+ // writeOracleIntervalDS()
879
+ //
880
+ // Writes a time interval to the buffer in Oracle Interval Day To Second
881
+ // format. It is assumed that the 'value' parameter is a valid IntervalDS
882
+ // object at this stage.
883
+ //---------------------------------------------------------------------------
884
+ writeOracleIntervalDS(value, writeLength = true) {
885
+ if (writeLength) {
886
+ this.writeUInt8(11);
887
+ }
888
+ this.writeUInt32BE(value.days + constants.TNS_DURATION_MID);
889
+ this.writeUInt8(value.hours + constants.TNS_DURATION_OFFSET);
890
+ this.writeUInt8(value.minutes + constants.TNS_DURATION_OFFSET);
891
+ this.writeUInt8(value.seconds + constants.TNS_DURATION_OFFSET);
892
+ this.writeUInt32BE(value.fseconds + constants.TNS_DURATION_MID);
893
+ }
894
+
804
895
  //---------------------------------------------------------------------------
805
896
  // writeOracleNumber()
806
897
  //
@@ -34,10 +34,12 @@ module.exports = {
34
34
  TNS_VECTOR_MAGIC_BYTE: 0xDB,
35
35
  TNS_VECTOR_VERSION_BASE: 0,
36
36
  TNS_VECTOR_VERSION_WITH_BINARY: 1,
37
+ TNS_VECTOR_VERSION_WITH_SPARSE: 2,
37
38
 
38
39
  // vector flags
39
40
  TNS_VECTOR_FLAG_NORMSRC: 0x0010,
40
41
  TNS_VECTOR_FLAG_NORM: 0x0002,
42
+ TNS_VECTOR_FLAG_SPARSE: 0x0020,
41
43
 
42
44
  // base JSON constants
43
45
  TNS_JSON_MAGIC_BYTE_1: 0xff,