oracledb 6.4.0 → 6.5.1

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 (60) hide show
  1. package/README.md +2 -2
  2. package/build/Release/oracledb-6.5.1-darwin-x64.node +0 -0
  3. package/build/Release/oracledb-6.5.1-darwin-x64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.5.1-js-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-6.5.1-linux-arm64.node +0 -0
  6. package/build/Release/oracledb-6.5.1-linux-arm64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.5.1-linux-x64.node +0 -0
  8. package/build/Release/oracledb-6.5.1-linux-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.5.1-win32-x64.node +0 -0
  10. package/build/Release/oracledb-6.5.1-win32-x64.node-buildinfo.txt +1 -0
  11. package/examples/README.md +2 -0
  12. package/lib/aqQueue.js +1 -1
  13. package/lib/connection.js +11 -14
  14. package/lib/errors.js +36 -2
  15. package/lib/impl/connection.js +2 -1
  16. package/lib/impl/datahandlers/buffer.js +2 -2
  17. package/lib/impl/datahandlers/constants.js +6 -5
  18. package/lib/impl/datahandlers/oson.js +301 -150
  19. package/lib/impl/datahandlers/vector.js +3 -22
  20. package/lib/oracledb.js +8 -25
  21. package/lib/pool.js +14 -1
  22. package/lib/settings.js +1 -0
  23. package/lib/thin/connection.js +23 -52
  24. package/lib/thin/pool.js +62 -6
  25. package/lib/thin/protocol/capabilities.js +17 -5
  26. package/lib/thin/protocol/constants.js +15 -2
  27. package/lib/thin/protocol/messages/auth.js +1 -1
  28. package/lib/thin/protocol/messages/base.js +8 -10
  29. package/lib/thin/protocol/messages/dataType.js +1 -0
  30. package/lib/thin/protocol/messages/execute.js +5 -1
  31. package/lib/thin/protocol/messages/{connectionCookie.js → fastAuth.js} +18 -16
  32. package/lib/thin/protocol/messages/fetch.js +4 -0
  33. package/lib/thin/protocol/messages/index.js +2 -2
  34. package/lib/thin/protocol/messages/protocol.js +9 -1
  35. package/lib/thin/protocol/messages/withData.js +13 -7
  36. package/lib/thin/protocol/packet.js +35 -4
  37. package/lib/thin/protocol/protocol.js +14 -5
  38. package/lib/thin/protocol/utils.js +11 -18
  39. package/lib/thin/sqlnet/constants.js +5 -2
  40. package/lib/thin/sqlnet/ezConnectResolver.js +9 -5
  41. package/lib/thin/sqlnet/navNodes.js +4 -3
  42. package/lib/thin/sqlnet/networkSession.js +14 -3
  43. package/lib/thin/sqlnet/packet.js +5 -6
  44. package/lib/thin/statement.js +40 -0
  45. package/lib/thin/statementCache.js +39 -11
  46. package/lib/thin/util.js +2 -2
  47. package/lib/transformer.js +9 -3
  48. package/lib/types.js +9 -1
  49. package/lib/util.js +29 -1
  50. package/lib/version.js +2 -2
  51. package/package.json +1 -1
  52. package/build/Release/oracledb-6.4.0-darwin-x64.node +0 -0
  53. package/build/Release/oracledb-6.4.0-darwin-x64.node-buildinfo.txt +0 -1
  54. package/build/Release/oracledb-6.4.0-js-buildinfo.txt +0 -1
  55. package/build/Release/oracledb-6.4.0-linux-arm64.node +0 -0
  56. package/build/Release/oracledb-6.4.0-linux-arm64.node-buildinfo.txt +0 -1
  57. package/build/Release/oracledb-6.4.0-linux-x64.node +0 -0
  58. package/build/Release/oracledb-6.4.0-linux-x64.node-buildinfo.txt +0 -1
  59. package/build/Release/oracledb-6.4.0-win32-x64.node +0 -0
  60. package/build/Release/oracledb-6.4.0-win32-x64.node-buildinfo.txt +0 -1
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # node-oracledb version 6.4.0
1
+ # node-oracledb version 6.5.1
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.4.0 to connect Node.js 14.6, or later, to Oracle
7
+ Use node-oracledb 6.5.1 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
 
@@ -0,0 +1 @@
1
+ oracledb-6.5.1-darwin-x64.node v20.11.1 572ce8bae4965b47d3554fa08a0d131acb4dc70b 077b92ae23b597c7854563e2ab4506966aa5fe40 Fri, 17 May 2024 14:57:54 GMT
@@ -0,0 +1 @@
1
+ 572ce8bae4965b47d3554fa08a0d131acb4dc70b
@@ -0,0 +1 @@
1
+ oracledb-6.5.1-linux-arm64.node v18.19.1 572ce8bae4965b47d3554fa08a0d131acb4dc70b 077b92ae23b597c7854563e2ab4506966aa5fe40 Fri, 17 May 2024 15:07:07 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.5.1-linux-x64.node v16.20.2 572ce8bae4965b47d3554fa08a0d131acb4dc70b 077b92ae23b597c7854563e2ab4506966aa5fe40 Fri, 17 May 2024 15:08:37 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.5.1-win32-x64.node v18.16.0 572ce8bae4965b47d3554fa08a0d131acb4dc70b 077b92ae23b597c7854563e2ab4506966aa5fe40 Fri, 17 May 2024 15:09:11 GMT
@@ -130,5 +130,7 @@ File Name | Description
130
130
  [`soda1.js`](soda1.js) | Basic Simple Oracle Document Access (SODA) example
131
131
  [`typehandlerdate.js`](typehandlerdate.js) | Show how a type handler can format a queried date in a locale-specific way
132
132
  [`typehandlernum.js`](typehandlernum.js) | Show how a type handler can alter queried numbers
133
+ [`vectortype1.js`](vectortype1.js) | Insert and query VECTOR columns.
134
+ [`vectortype2.js`](vectortype2.js) | Insert data into VECTOR columns and verify vector operations.
133
135
  [`version.js`](version.js) | Shows the node-oracledb version attributes
134
136
  [`webapp.js`](webapp.js) | A simple web application using a connection pool
package/lib/aqQueue.js CHANGED
@@ -181,7 +181,7 @@ class AqQueue {
181
181
  async deqOne() {
182
182
  errors.assertArgCount(arguments, 0, 0);
183
183
  const msgImpls = await this._impl.deq(1);
184
- if (msgImpls)
184
+ if (msgImpls.length > 0)
185
185
  return this._makeMessage(msgImpls[0]);
186
186
  }
187
187
 
package/lib/connection.js CHANGED
@@ -200,12 +200,13 @@ class Connection extends EventEmitter {
200
200
  typeof value === 'number' ||
201
201
  typeof value === 'string' ||
202
202
  typeof value === 'boolean' ||
203
+ typeof value === 'bigint' ||
203
204
  Array.isArray(value) ||
204
205
  value instanceof Float32Array ||
205
206
  value instanceof Float64Array ||
206
207
  value instanceof Int8Array ||
207
208
  Buffer.isBuffer(value) ||
208
- util.isDate(value) ||
209
+ util.types.isDate(value) ||
209
210
  value instanceof Lob ||
210
211
  value instanceof ResultSet ||
211
212
  value instanceof BaseDbObject
@@ -570,11 +571,8 @@ class Connection extends EventEmitter {
570
571
  } else {
571
572
 
572
573
  // fetchArraySize must be a positive integer
573
- if (options.fetchArraySize !== undefined) {
574
- errors.assertParamPropValue(Number.isInteger(options.fetchArraySize) &&
575
- options.fetchArraySize > 0, 3, "fetchArraySize");
576
- outOptions.fetchArraySize = options.fetchArraySize;
577
- }
574
+ errors.assertParamPropUnsignedIntNonZero(options, 3, "fetchArraySize");
575
+ outOptions.fetchArraySize = options.fetchArraySize;
578
576
 
579
577
  // fetchInfo must be an object with keys containing an object with a
580
578
  // "type" property; these are converted to an array of objects for ease
@@ -860,7 +858,7 @@ class Connection extends EventEmitter {
860
858
  //---------------------------------------------------------------------------
861
859
  encodeOSON(value) {
862
860
  const encoder = new oson.OsonEncoder();
863
- return encoder.encode(transformer.transformJsonValue(value));
861
+ return encoder.encode(transformer.transformJsonValue(value), this._impl._osonMaxFieldNameSize);
864
862
  }
865
863
 
866
864
  //---------------------------------------------------------------------------
@@ -927,8 +925,8 @@ class Connection extends EventEmitter {
927
925
 
928
926
  // process output binds
929
927
  if (result.outBinds !== undefined) {
930
- for (const key in result.outBinds) {
931
- const val = this._transformOutBind(result.outBinds[key], options);
928
+ for (const [key, value] of Object.entries(result.outBinds)) {
929
+ const val = this._transformOutBind(value, options);
932
930
  result.outBinds[key] = val;
933
931
  }
934
932
  }
@@ -937,10 +935,9 @@ class Connection extends EventEmitter {
937
935
  // array size fixed, or, if a result set is not requested, that all rows
938
936
  // are fetched
939
937
  if (result.implicitResults) {
940
- for (const key in result.implicitResults) {
941
- const resultSetImpl = result.implicitResults[key];
938
+ for (const [key, impl] of Object.entries(result.implicitResults)) {
942
939
  const resultSet = new ResultSet();
943
- resultSet._setup(this, resultSetImpl);
940
+ resultSet._setup(this, impl);
944
941
  if (options.resultSet) {
945
942
  result.implicitResults[key] = resultSet;
946
943
  } else {
@@ -996,8 +993,8 @@ class Connection extends EventEmitter {
996
993
  if (result.outBinds !== undefined) {
997
994
  for (let i = 0; i < result.outBinds.length; i++) {
998
995
  const outBind = result.outBinds[i];
999
- for (const key in outBind) {
1000
- outBind[key] = this._transformOutBind(outBind[key], options);
996
+ for (const [key, value] of Object.entries(outBind)) {
997
+ outBind[key] = this._transformOutBind(value, options);
1001
998
  }
1002
999
  }
1003
1000
  }
package/lib/errors.js CHANGED
@@ -31,6 +31,17 @@ const util = require('util');
31
31
  // define error prefix for all messages
32
32
  const ERR_PREFIX = "NJS";
33
33
 
34
+ const ERR_INTEGRITY_ERROR_CODES = [
35
+ 1, // unique constraint violated
36
+ 1400, // cannot insert NULL
37
+ 1438, // value larger than specified precision
38
+ 2290, // check constraint violated
39
+ 2291, // integrity constraint violated - parent key not found
40
+ 2292, // integrity constraint violated - child record found
41
+ 21525, // attribute or collection element violated its constraints
42
+ 40479, // internal JSON serializer error
43
+ ];
44
+
34
45
  // define error number constants (used in JavaScript library)
35
46
  const ERR_INVALID_POOL = 2;
36
47
  const ERR_INVALID_CONNECTION = 3;
@@ -143,6 +154,8 @@ const ERR_WRONG_LENGTH_FOR_DBOBJECT_ELEM = 143;
143
154
  const ERR_VECTOR_FORMAT_NOT_SUPPORTED = 144;
144
155
  const ERR_VECTOR_VERSION_NOT_SUPPORTED = 145;
145
156
  const ERR_OBJECT_IS_NOT_A_COLLECTION = 146;
157
+ const ERR_CURSOR_HAS_BEEN_CLOSED = 147;
158
+ const ERR_DML_RETURNING_DUP_BINDS = 149;
146
159
 
147
160
  // Oracle Net layer errors start from 500
148
161
  const ERR_CONNECTION_CLOSED = 500;
@@ -356,7 +369,7 @@ messages.set(ERR_INTEGER_TOO_LARGE, // NJS-112
356
369
  messages.set(ERR_UNEXPECTED_DATA, // NJS-113
357
370
  'unexpected data received: %s');
358
371
  messages.set(ERR_OSON_FIELD_NAME_LIMITATION, // NJS-114
359
- 'OSON field names may not exceed 255 UTF-8 encoded bytes');
372
+ 'OSON field names may not exceed %d UTF-8 encoded bytes');
360
373
  messages.set(ERR_ORACLE_NUMBER_NO_REPR, // NJS-115
361
374
  'value cannot be represented as an Oracle Database number');
362
375
  messages.set(ERR_UNSUPPORTED_VERIFIER_TYPE, // NJS-116
@@ -417,6 +430,10 @@ messages.set(ERR_VECTOR_VERSION_NOT_SUPPORTED, // NJS-145
417
430
  'VECTOR version %d is not supported');
418
431
  messages.set(ERR_OBJECT_IS_NOT_A_COLLECTION, // NJS-146
419
432
  'object %s is not a collection');
433
+ messages.set(ERR_CURSOR_HAS_BEEN_CLOSED, // NJS-147
434
+ 'cursor has been closed by the database');
435
+ messages.set(ERR_DML_RETURNING_DUP_BINDS, // NJS-149
436
+ 'the bind variable placeholder "%s" cannot be used both before and after the RETURNING clause in a DML RETURNING statement');
420
437
 
421
438
  // Oracle Net layer errors
422
439
 
@@ -543,6 +560,19 @@ function assertParamPropUnsignedInt(obj, parameterNum, propName) {
543
560
  }
544
561
  }
545
562
 
563
+ //-----------------------------------------------------------------------------
564
+ // assertParamPropUnsignedIntNonZero()
565
+ //
566
+ // Asserts that the property value of a parameter is a positive integer value
567
+ // (or undefined).
568
+ //-----------------------------------------------------------------------------
569
+ function assertParamPropUnsignedIntNonZero(obj, parameterNum, propName) {
570
+ if (obj[propName] !== undefined) {
571
+ assertParamPropValue(Number.isInteger(obj[propName]) && obj[propName] > 0,
572
+ parameterNum, propName);
573
+ }
574
+ }
575
+
546
576
  //-----------------------------------------------------------------------------
547
577
  // assertParamPropString()
548
578
  //
@@ -639,7 +669,7 @@ function transformErr(err, fnOpt) {
639
669
  err.code = err.message.substr(0, pos);
640
670
  /* add Oracle Database Error Help Portal URL for database error
641
671
  messages, but only in thin mode since this is done
642
- automatically in thick mode with Oracle Client 23c and higher
672
+ automatically in thick mode with Oracle Client 23ai and higher
643
673
  */
644
674
  const settings = require('./settings.js');
645
675
  if (err.errorNum && settings.thin) {
@@ -676,6 +706,7 @@ function transformErr(err, fnOpt) {
676
706
 
677
707
  // define exports
678
708
  module.exports = {
709
+ ERR_INTEGRITY_ERROR_CODES,
679
710
  ERR_INVALID_POOL,
680
711
  ERR_INVALID_CONNECTION,
681
712
  ERR_INVALID_PROPERTY_VALUE,
@@ -808,6 +839,8 @@ module.exports = {
808
839
  ERR_VECTOR_FORMAT_NOT_SUPPORTED,
809
840
  ERR_VECTOR_VERSION_NOT_SUPPORTED,
810
841
  ERR_OBJECT_IS_NOT_A_COLLECTION,
842
+ ERR_CURSOR_HAS_BEEN_CLOSED,
843
+ ERR_DML_RETURNING_DUP_BINDS,
811
844
  ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
812
845
  WRN_COMPILATION_CREATE,
813
846
  assert,
@@ -817,6 +850,7 @@ module.exports = {
817
850
  assertParamPropInt,
818
851
  assertParamPropString,
819
852
  assertParamPropUnsignedInt,
853
+ assertParamPropUnsignedIntNonZero,
820
854
  assertParamPropValue,
821
855
  assertParamValue,
822
856
  assertPropValue,
@@ -37,6 +37,7 @@ class ConnectionImpl {
37
37
  this._inProgress = false;
38
38
  this._dbObjectTypes = new Map();
39
39
  this._requestQueue = [];
40
+ this._osonMaxFieldNameSize = 255;
40
41
  }
41
42
 
42
43
  //---------------------------------------------------------------------------
@@ -110,7 +111,7 @@ class ConnectionImpl {
110
111
  // removed once Node-API version 5 is used in the C extension.
111
112
  // ---------------------------------------------------------------------------
112
113
  _isDate(val) {
113
- return (util.isDate(val));
114
+ return (util.types.isDate(val));
114
115
  }
115
116
 
116
117
  //---------------------------------------------------------------------------
@@ -843,8 +843,8 @@ class BaseBuffer {
843
843
  }
844
844
 
845
845
  // throw exception if number cannot be represented as an Oracle Number
846
- if (value.length > constants.NUMBER_MAX_DIGITS || exponent > 126 ||
847
- exponent < -129) {
846
+ if (value.length > constants.NUMBER_MAX_DIGITS || exponent >= 126 ||
847
+ exponent <= -131) {
848
848
  errors.throwErr(errors.ERR_ORACLE_NUMBER_NO_REPR);
849
849
  }
850
850
 
@@ -35,16 +35,15 @@ module.exports = {
35
35
  TNS_VECTOR_VERSION: 0,
36
36
 
37
37
  // vector flags
38
- TNS_VECTOR_FLAG_DIM_UINT8: 0x0001,
39
- TNS_VECTOR_FLAG_DIM_UINT32: 0x0002,
40
- TNS_VECTOR_FLAG_NORMSRC: 0x0040,
41
- TNS_VECTOR_FLAG_NORM: 0x0008,
38
+ TNS_VECTOR_FLAG_NORMSRC: 0x0010,
39
+ TNS_VECTOR_FLAG_NORM: 0x0002,
42
40
 
43
41
  // base JSON constants
44
42
  TNS_JSON_MAGIC_BYTE_1: 0xff,
45
43
  TNS_JSON_MAGIC_BYTE_2: 0x4a, // 'J'
46
44
  TNS_JSON_MAGIC_BYTE_3: 0x5a, // 'Z'
47
- TNS_JSON_VERSION: 1,
45
+ TNS_JSON_VERSION_MAX_FNAME_255: 1,
46
+ TNS_JSON_VERSION_MAX_FNAME_65535: 3,
48
47
  TNS_JSON_FLAG_HASH_ID_UINT8: 0x0100,
49
48
  TNS_JSON_FLAG_HASH_ID_UINT16: 0x0200,
50
49
  TNS_JSON_FLAG_NUM_FNAMES_UINT16: 0x0400,
@@ -56,6 +55,7 @@ module.exports = {
56
55
  TNS_JSON_FLAG_LEN_IN_PCODE: 0x04,
57
56
  TNS_JSON_FLAG_NUM_FNAMES_UINT32: 0x08,
58
57
  TNS_JSON_FLAG_IS_SCALAR: 0x10,
58
+ TNS_JSON_FLAG_SEC_FNAMES_SEG_UINT16: 0x100,
59
59
 
60
60
  // JSON data types
61
61
  TNS_JSON_TYPE_NULL: 0x30,
@@ -79,6 +79,7 @@ module.exports = {
79
79
  TNS_JSON_TYPE_ARRAY: 0xc0,
80
80
  TNS_JSON_TYPE_EXTENDED: 0x7b,
81
81
  TNS_JSON_TYPE_VECTOR: 0x01,
82
+ TNS_JSON_TYPE_ID: 0x7e,
82
83
 
83
84
  // timezone offsets
84
85
  TZ_HOUR_OFFSET: 20,