oracledb 6.3.0 → 6.5.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 (71) 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.5.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-6.5.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.5.0-js-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.5.0-linux-arm64.node +0 -0
  8. package/build/Release/oracledb-6.5.0-linux-arm64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.5.0-linux-x64.node +0 -0
  10. package/build/Release/oracledb-6.5.0-linux-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.5.0-win32-x64.node +0 -0
  12. package/build/Release/oracledb-6.5.0-win32-x64.node-buildinfo.txt +1 -0
  13. package/examples/README.md +3 -0
  14. package/lib/aqQueue.js +8 -8
  15. package/lib/connection.js +65 -22
  16. package/lib/constants.js +7 -1
  17. package/lib/dbObject.js +72 -1
  18. package/lib/errors.js +51 -10
  19. package/lib/impl/connection.js +2 -1
  20. package/lib/{thin/protocol → impl/datahandlers}/buffer.js +36 -32
  21. package/lib/impl/datahandlers/constants.js +106 -0
  22. package/lib/{thin/protocol → impl/datahandlers}/oson.js +320 -151
  23. package/lib/impl/datahandlers/vector.js +137 -0
  24. package/lib/impl/pool.js +9 -0
  25. package/lib/impl/resultset.js +34 -17
  26. package/lib/lob.js +22 -6
  27. package/lib/oracledb.js +35 -1
  28. package/lib/pool.js +17 -2
  29. package/lib/poolStatistics.js +3 -1
  30. package/lib/settings.js +31 -6
  31. package/lib/sodaDocCursor.js +14 -1
  32. package/lib/thin/connection.js +120 -193
  33. package/lib/thin/dbObject.js +4 -2
  34. package/lib/thin/lob.js +6 -6
  35. package/lib/thin/pool.js +84 -10
  36. package/lib/thin/protocol/capabilities.js +20 -6
  37. package/lib/thin/protocol/constants.js +34 -54
  38. package/lib/thin/protocol/messages/auth.js +2 -2
  39. package/lib/thin/protocol/messages/base.js +28 -27
  40. package/lib/thin/protocol/messages/dataType.js +4 -2
  41. package/lib/thin/protocol/messages/execute.js +5 -1
  42. package/lib/thin/protocol/messages/{connectionCookie.js → fastAuth.js} +18 -16
  43. package/lib/thin/protocol/messages/fetch.js +4 -0
  44. package/lib/thin/protocol/messages/index.js +2 -2
  45. package/lib/thin/protocol/messages/protocol.js +9 -1
  46. package/lib/thin/protocol/messages/withData.js +40 -11
  47. package/lib/thin/protocol/packet.js +93 -8
  48. package/lib/thin/protocol/protocol.js +10 -5
  49. package/lib/thin/protocol/utils.js +11 -18
  50. package/lib/thin/sqlnet/constants.js +5 -2
  51. package/lib/thin/sqlnet/ezConnectResolver.js +9 -5
  52. package/lib/thin/sqlnet/navNodes.js +4 -3
  53. package/lib/thin/sqlnet/networkSession.js +27 -4
  54. package/lib/thin/sqlnet/packet.js +2 -5
  55. package/lib/thin/statement.js +43 -7
  56. package/lib/thin/statementCache.js +190 -0
  57. package/lib/thin/util.js +2 -2
  58. package/lib/transformer.js +21 -6
  59. package/lib/types.js +21 -3
  60. package/lib/util.js +30 -1
  61. package/lib/version.js +2 -2
  62. package/package.json +1 -1
  63. package/build/Release/oracledb-6.3.0-darwin-x64.node +0 -0
  64. package/build/Release/oracledb-6.3.0-darwin-x64.node-buildinfo.txt +0 -1
  65. package/build/Release/oracledb-6.3.0-js-buildinfo.txt +0 -1
  66. package/build/Release/oracledb-6.3.0-linux-arm64.node +0 -0
  67. package/build/Release/oracledb-6.3.0-linux-arm64.node-buildinfo.txt +0 -1
  68. package/build/Release/oracledb-6.3.0-linux-x64.node +0 -0
  69. package/build/Release/oracledb-6.3.0-linux-x64.node-buildinfo.txt +0 -1
  70. package/build/Release/oracledb-6.3.0-win32-x64.node +0 -0
  71. package/build/Release/oracledb-6.3.0-win32-x64.node-buildinfo.txt +0 -1
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
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 settings._makeDate(useLocalTime, year, buf[2], buf[3], buf[4] - 1,
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
- this.writeUInt8(8);
622
- const pos = this.reserveBytes(8);
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
- this.writeUInt8(4);
646
- const pos = this.reserveBytes(4);
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
  //
@@ -0,0 +1,106 @@
1
+ // Copyright (c) 2024, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+ 'use strict';
28
+
29
+ const constants = require('../../constants.js');
30
+
31
+ module.exports = {
32
+
33
+ // vector constants
34
+ TNS_VECTOR_MAGIC_BYTE: 0xDB,
35
+ TNS_VECTOR_VERSION: 0,
36
+
37
+ // vector flags
38
+ TNS_VECTOR_FLAG_NORMSRC: 0x0010,
39
+ TNS_VECTOR_FLAG_NORM: 0x0002,
40
+
41
+ // base JSON constants
42
+ TNS_JSON_MAGIC_BYTE_1: 0xff,
43
+ TNS_JSON_MAGIC_BYTE_2: 0x4a, // 'J'
44
+ TNS_JSON_MAGIC_BYTE_3: 0x5a, // 'Z'
45
+ TNS_JSON_VERSION_MAX_FNAME_255: 1,
46
+ TNS_JSON_VERSION_MAX_FNAME_65535: 3,
47
+ TNS_JSON_FLAG_HASH_ID_UINT8: 0x0100,
48
+ TNS_JSON_FLAG_HASH_ID_UINT16: 0x0200,
49
+ TNS_JSON_FLAG_NUM_FNAMES_UINT16: 0x0400,
50
+ TNS_JSON_FLAG_FNAMES_SEG_UINT32: 0x0800,
51
+ TNS_JSON_FLAG_TINY_NODES_STAT: 0x2000,
52
+ TNS_JSON_FLAG_TREE_SEG_UINT32: 0x1000,
53
+ TNS_JSON_FLAG_REL_OFFSET_MODE: 0x01,
54
+ TNS_JSON_FLAG_INLINE_LEAF: 0x02,
55
+ TNS_JSON_FLAG_LEN_IN_PCODE: 0x04,
56
+ TNS_JSON_FLAG_NUM_FNAMES_UINT32: 0x08,
57
+ TNS_JSON_FLAG_IS_SCALAR: 0x10,
58
+ TNS_JSON_FLAG_SEC_FNAMES_SEG_UINT16: 0x100,
59
+
60
+ // JSON data types
61
+ TNS_JSON_TYPE_NULL: 0x30,
62
+ TNS_JSON_TYPE_TRUE: 0x31,
63
+ TNS_JSON_TYPE_FALSE: 0x32,
64
+ TNS_JSON_TYPE_STRING_LENGTH_UINT8: 0x33,
65
+ TNS_JSON_TYPE_NUMBER_LENGTH_UINT8: 0x34,
66
+ TNS_JSON_TYPE_BINARY_DOUBLE: 0x36,
67
+ TNS_JSON_TYPE_STRING_LENGTH_UINT16: 0x37,
68
+ TNS_JSON_TYPE_STRING_LENGTH_UINT32: 0x38,
69
+ TNS_JSON_TYPE_TIMESTAMP: 0x39,
70
+ TNS_JSON_TYPE_BINARY_LENGTH_UINT16: 0x3a,
71
+ TNS_JSON_TYPE_BINARY_LENGTH_UINT32: 0x3b,
72
+ TNS_JSON_TYPE_DATE: 0x3c,
73
+ TNS_JSON_TYPE_INTERVAL_YM: 0x3d,
74
+ TNS_JSON_TYPE_INTERVAL_DS: 0x3e,
75
+ TNS_JSON_TYPE_TIMESTAMP_TZ: 0x7c,
76
+ TNS_JSON_TYPE_TIMESTAMP7: 0x7d,
77
+ TNS_JSON_TYPE_BINARY_FLOAT: 0x7f,
78
+ TNS_JSON_TYPE_OBJECT: 0x84,
79
+ TNS_JSON_TYPE_ARRAY: 0xc0,
80
+ TNS_JSON_TYPE_EXTENDED: 0x7b,
81
+ TNS_JSON_TYPE_VECTOR: 0x01,
82
+ TNS_JSON_TYPE_ID: 0x7e,
83
+
84
+ // timezone offsets
85
+ TZ_HOUR_OFFSET: 20,
86
+ TZ_MINUTE_OFFSET: 60,
87
+
88
+ // general constants
89
+ TNS_MAX_SHORT_LENGTH: 252,
90
+ TNS_DURATION_MID: 0x80000000,
91
+ TNS_DURATION_OFFSET: 60,
92
+ TNS_CHUNK_SIZE: 32767,
93
+ TNS_HAS_REGION_ID: 0x80,
94
+ NUMBER_MAX_DIGITS: 40,
95
+ BUFFER_CHUNK_SIZE: 65536,
96
+ CSFRM_IMPLICIT: constants.CSFRM_IMPLICIT,
97
+
98
+ // vector generic constants
99
+ VECTOR_FORMAT_FLOAT32: constants.VECTOR_FORMAT_FLOAT32,
100
+ VECTOR_FORMAT_FLOAT64: constants.VECTOR_FORMAT_FLOAT64,
101
+ VECTOR_FORMAT_INT8: constants.VECTOR_FORMAT_INT8,
102
+
103
+ TNS_NULL_LENGTH_INDICATOR: 255,
104
+ TNS_LONG_LENGTH_INDICATOR: 254,
105
+
106
+ };