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.
Files changed (58) 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.4.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-6.4.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.4.0-js-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.4.0-linux-arm64.node +0 -0
  8. package/build/Release/oracledb-6.4.0-linux-arm64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.4.0-linux-x64.node +0 -0
  10. package/build/Release/oracledb-6.4.0-linux-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.4.0-win32-x64.node +0 -0
  12. package/build/Release/oracledb-6.4.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 +55 -9
  16. package/lib/constants.js +7 -1
  17. package/lib/dbObject.js +72 -1
  18. package/lib/errors.js +27 -8
  19. package/lib/{thin/protocol → impl/datahandlers}/buffer.js +36 -32
  20. package/lib/impl/datahandlers/constants.js +105 -0
  21. package/lib/{thin/protocol → impl/datahandlers}/oson.js +19 -1
  22. package/lib/impl/datahandlers/vector.js +156 -0
  23. package/lib/impl/pool.js +9 -0
  24. package/lib/impl/resultset.js +34 -17
  25. package/lib/lob.js +22 -6
  26. package/lib/oracledb.js +24 -0
  27. package/lib/pool.js +10 -1
  28. package/lib/poolStatistics.js +3 -1
  29. package/lib/settings.js +30 -6
  30. package/lib/sodaDocCursor.js +14 -1
  31. package/lib/thin/connection.js +100 -144
  32. package/lib/thin/dbObject.js +4 -2
  33. package/lib/thin/lob.js +6 -6
  34. package/lib/thin/pool.js +22 -4
  35. package/lib/thin/protocol/capabilities.js +3 -1
  36. package/lib/thin/protocol/constants.js +20 -52
  37. package/lib/thin/protocol/messages/auth.js +1 -1
  38. package/lib/thin/protocol/messages/base.js +21 -18
  39. package/lib/thin/protocol/messages/dataType.js +3 -2
  40. package/lib/thin/protocol/messages/withData.js +38 -6
  41. package/lib/thin/protocol/packet.js +58 -4
  42. package/lib/thin/sqlnet/networkSession.js +13 -1
  43. package/lib/thin/statement.js +7 -7
  44. package/lib/thin/statementCache.js +167 -0
  45. package/lib/transformer.js +13 -4
  46. package/lib/types.js +12 -2
  47. package/lib/util.js +29 -0
  48. package/lib/version.js +2 -2
  49. package/package.json +1 -1
  50. package/build/Release/oracledb-6.3.0-darwin-x64.node +0 -0
  51. package/build/Release/oracledb-6.3.0-darwin-x64.node-buildinfo.txt +0 -1
  52. package/build/Release/oracledb-6.3.0-js-buildinfo.txt +0 -1
  53. package/build/Release/oracledb-6.3.0-linux-arm64.node +0 -0
  54. package/build/Release/oracledb-6.3.0-linux-arm64.node-buildinfo.txt +0 -1
  55. package/build/Release/oracledb-6.3.0-linux-x64.node +0 -0
  56. package/build/Release/oracledb-6.3.0-linux-x64.node-buildinfo.txt +0 -1
  57. package/build/Release/oracledb-6.3.0-win32-x64.node +0 -0
  58. package/build/Release/oracledb-6.3.0-win32-x64.node-buildinfo.txt +0 -1
@@ -0,0 +1,105 @@
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_DIM_UINT8: 0x0001,
39
+ TNS_VECTOR_FLAG_DIM_UINT32: 0x0002,
40
+ TNS_VECTOR_FLAG_NORMSRC: 0x0040,
41
+ TNS_VECTOR_FLAG_NORM: 0x0008,
42
+
43
+ // base JSON constants
44
+ TNS_JSON_MAGIC_BYTE_1: 0xff,
45
+ TNS_JSON_MAGIC_BYTE_2: 0x4a, // 'J'
46
+ TNS_JSON_MAGIC_BYTE_3: 0x5a, // 'Z'
47
+ TNS_JSON_VERSION: 1,
48
+ TNS_JSON_FLAG_HASH_ID_UINT8: 0x0100,
49
+ TNS_JSON_FLAG_HASH_ID_UINT16: 0x0200,
50
+ TNS_JSON_FLAG_NUM_FNAMES_UINT16: 0x0400,
51
+ TNS_JSON_FLAG_FNAMES_SEG_UINT32: 0x0800,
52
+ TNS_JSON_FLAG_TINY_NODES_STAT: 0x2000,
53
+ TNS_JSON_FLAG_TREE_SEG_UINT32: 0x1000,
54
+ TNS_JSON_FLAG_REL_OFFSET_MODE: 0x01,
55
+ TNS_JSON_FLAG_INLINE_LEAF: 0x02,
56
+ TNS_JSON_FLAG_LEN_IN_PCODE: 0x04,
57
+ TNS_JSON_FLAG_NUM_FNAMES_UINT32: 0x08,
58
+ TNS_JSON_FLAG_IS_SCALAR: 0x10,
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
+
83
+ // timezone offsets
84
+ TZ_HOUR_OFFSET: 20,
85
+ TZ_MINUTE_OFFSET: 60,
86
+
87
+ // general constants
88
+ TNS_MAX_SHORT_LENGTH: 252,
89
+ TNS_DURATION_MID: 0x80000000,
90
+ TNS_DURATION_OFFSET: 60,
91
+ TNS_CHUNK_SIZE: 32767,
92
+ TNS_HAS_REGION_ID: 0x80,
93
+ NUMBER_MAX_DIGITS: 40,
94
+ BUFFER_CHUNK_SIZE: 65536,
95
+ CSFRM_IMPLICIT: constants.CSFRM_IMPLICIT,
96
+
97
+ // vector generic constants
98
+ VECTOR_FORMAT_FLOAT32: constants.VECTOR_FORMAT_FLOAT32,
99
+ VECTOR_FORMAT_FLOAT64: constants.VECTOR_FORMAT_FLOAT64,
100
+ VECTOR_FORMAT_INT8: constants.VECTOR_FORMAT_INT8,
101
+
102
+ TNS_NULL_LENGTH_INDICATOR: 255,
103
+ TNS_LONG_LENGTH_INDICATOR: 254,
104
+
105
+ };
@@ -32,6 +32,8 @@ const constants = require("./constants.js");
32
32
  const errors = require("../../errors.js");
33
33
  const types = require("../../types.js");
34
34
  const util = require("util");
35
+ const vector = require("./vector.js");
36
+ const nodbUtil = require("../../util.js");
35
37
 
36
38
  /**
37
39
  * Class used for decodeing
@@ -106,7 +108,7 @@ class OsonDecoder extends BaseBuffer {
106
108
  _decodeNode() {
107
109
 
108
110
  // if the most significant bit is set the node refers to a container
109
- const nodeType = this.readUInt8();
111
+ let nodeType = this.readUInt8();
110
112
  if (nodeType & 0x80) {
111
113
  return this._decodeContainerNode(nodeType);
112
114
  }
@@ -145,6 +147,13 @@ class OsonDecoder extends BaseBuffer {
145
147
  return Buffer.from(this.readBytes(this.readUInt16BE()));
146
148
  } else if (nodeType === constants.TNS_JSON_TYPE_BINARY_LENGTH_UINT32) {
147
149
  return Buffer.from(this.readBytes(this.readUInt32BE()));
150
+ } else if (nodeType === constants.TNS_JSON_TYPE_EXTENDED) {
151
+ nodeType = this.readUInt8();
152
+ if (nodeType === constants.TNS_JSON_TYPE_VECTOR) {
153
+ const vecImage = this.readBytes(this.readUInt32BE());
154
+ const decoder = new vector.VectorDecoder(vecImage);
155
+ return decoder.decode();
156
+ }
148
157
  }
149
158
 
150
159
  // handle number/decimal with length stored inside the node itself
@@ -544,6 +553,15 @@ class OsonTreeSegment extends GrowableBuffer {
544
553
  } else if (Array.isArray(value)) {
545
554
  this._encodeArray(value, fnamesSeg);
546
555
 
556
+ // handle vectors
557
+ } else if (nodbUtil.isVectorValue(value)) {
558
+ this.writeUInt8(constants.TNS_JSON_TYPE_EXTENDED);
559
+ this.writeUInt8(constants.TNS_JSON_TYPE_VECTOR);
560
+ const encoder = new vector.VectorEncoder();
561
+ const buf = encoder.encode(value);
562
+ this.writeUInt32BE(buf.length);
563
+ this.writeBytes(buf);
564
+
547
565
  // handle objects
548
566
  } else {
549
567
  this._encodeObject(value, fnamesSeg);
@@ -0,0 +1,156 @@
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 { BaseBuffer, GrowableBuffer } = require('./buffer.js');
30
+ const { Buffer } = require('buffer');
31
+ const constants = require("./constants.js");
32
+ const errors = require("../../errors.js");
33
+
34
+ /**
35
+ * Class used for decoding
36
+ */
37
+ class VectorDecoder extends BaseBuffer {
38
+
39
+ //---------------------------------------------------------------------------
40
+ // decode()
41
+ //
42
+ // Decodes the VECTOR image and returns a JavaScript array corresponding to
43
+ // its contents.
44
+ //---------------------------------------------------------------------------
45
+ decode() {
46
+
47
+ // parse header
48
+ const magicByte = this.readUInt8();
49
+ if (magicByte != constants.TNS_VECTOR_MAGIC_BYTE)
50
+ errors.throwErr(errors.ERR_UNEXPECTED_DATA,
51
+ Buffer.from([magicByte]).toString('hex'));
52
+ const version = this.readUInt8();
53
+ if (version != constants.TNS_VECTOR_VERSION)
54
+ errors.throwErr(errors.ERR_VECTOR_VERSION_NOT_SUPPORTED, version);
55
+ const flags = this.readUInt16BE();
56
+ const vectorFormat = this.readUInt8();
57
+ let numElements;
58
+ if (flags & constants.TNS_VECTOR_FLAG_DIM_UINT8) {
59
+ numElements = this.readUInt8();
60
+ } else if (flags & constants.TNS_VECTOR_FLAG_DIM_UINT32) {
61
+ numElements = this.readUInt32BE();
62
+ } else {
63
+ numElements = this.readUInt16BE();
64
+ }
65
+ let elementSize, result;
66
+ if (vectorFormat === constants.VECTOR_FORMAT_FLOAT32) {
67
+ elementSize = 4;
68
+ result = new Float32Array(numElements);
69
+ } else if (vectorFormat === constants.VECTOR_FORMAT_FLOAT64) {
70
+ elementSize = 8;
71
+ result = new Float64Array(numElements);
72
+ } else if (vectorFormat === constants.VECTOR_FORMAT_INT8) {
73
+ elementSize = 1;
74
+ result = new Int8Array(numElements);
75
+ } else {
76
+ errors.throwErr(errors.ERR_VECTOR_FORMAT_NOT_SUPPORTED, vectorFormat);
77
+ }
78
+ if (flags & constants.TNS_VECTOR_FLAG_NORM)
79
+ this.skipBytes(8);
80
+
81
+ // parse data
82
+ for (let i = 0; i < numElements; i++) {
83
+ const buf = this.readBytes(elementSize);
84
+ if (vectorFormat === constants.VECTOR_FORMAT_FLOAT32) {
85
+ result[i] = this.parseBinaryFloat(buf);
86
+ } else if (vectorFormat === constants.VECTOR_FORMAT_FLOAT64) {
87
+ result[i] = this.parseBinaryDouble(buf);
88
+ } else {
89
+ result[i] = buf[0];
90
+ }
91
+ }
92
+
93
+ return result;
94
+ }
95
+
96
+ }
97
+
98
+ class VectorEncoder extends GrowableBuffer {
99
+
100
+ //---------------------------------------------------------------------------
101
+ // encode()
102
+ //
103
+ // Encodes the value as OSON and returns a buffer containing the OSON bytes.
104
+ //---------------------------------------------------------------------------
105
+ encode(value) {
106
+
107
+ // determine some basic information about the vector
108
+ let vectorFormat = constants.VECTOR_FORMAT_FLOAT32;
109
+ let writeFn = this.writeBinaryFloat.bind(this);
110
+
111
+ if (Array.isArray(value) || value instanceof Float64Array) {
112
+ vectorFormat = constants.VECTOR_FORMAT_FLOAT64;
113
+ writeFn = this.writeBinaryDouble.bind(this);
114
+ } else if (value instanceof Int8Array) {
115
+ vectorFormat = constants.VECTOR_FORMAT_INT8;
116
+ writeFn = this.writeSB1.bind(this);
117
+ }
118
+
119
+ // Let server generate the norm (TNS_VECTOR_FLAG_NORMSRC)
120
+ let flags = constants.TNS_VECTOR_FLAG_NORM
121
+ | constants.TNS_VECTOR_FLAG_NORMSRC;
122
+ const numElements = value.length;
123
+ if (numElements < 256) {
124
+ flags |= constants.TNS_VECTOR_FLAG_DIM_UINT8;
125
+ } else if (numElements > 65535) {
126
+ flags |= constants.TNS_VECTOR_FLAG_DIM_UINT32;
127
+ }
128
+
129
+ // write header
130
+ this.writeUInt8(constants.TNS_VECTOR_MAGIC_BYTE);
131
+ this.writeUInt8(constants.TNS_VECTOR_VERSION);
132
+ this.writeUInt16BE(flags);
133
+ this.writeUInt8(vectorFormat);
134
+ if (numElements < 256) {
135
+ this.writeUInt8(numElements);
136
+ } else if (numElements < 65536) {
137
+ this.writeUInt16BE(numElements);
138
+ } else {
139
+ this.writeUInt32BE(numElements);
140
+ }
141
+ this.reserveBytes(8);
142
+
143
+ // write data
144
+ value.forEach((element) => {
145
+ writeFn(element);
146
+ });
147
+
148
+ return this.buf.subarray(0, this.pos);
149
+ }
150
+
151
+ }
152
+
153
+ module.exports = {
154
+ VectorDecoder,
155
+ VectorEncoder
156
+ };
package/lib/impl/pool.js CHANGED
@@ -147,6 +147,15 @@ class PoolImpl {
147
147
  errors.throwNotImplemented("getting the pool ping interval");
148
148
  }
149
149
 
150
+ //---------------------------------------------------------------------------
151
+ // getPoolPingTimeout()
152
+ //
153
+ // Returns the pool ping Timeout (milliseconds).
154
+ //---------------------------------------------------------------------------
155
+ getPoolPingTimeout() {
156
+ errors.throwNotImplemented("getting the pool ping Timeout");
157
+ }
158
+
150
159
  //---------------------------------------------------------------------------
151
160
  // getPoolTimeout()
152
161
  //
@@ -33,6 +33,7 @@ const settings = require('../settings.js');
33
33
  const future = require('../future.js');
34
34
  const types = require('../types.js');
35
35
  const Lob = require('../lob.js');
36
+ const oson = require('./datahandlers/oson.js');
36
37
 
37
38
  // define implementation class
38
39
  class ResultSetImpl {
@@ -105,26 +106,42 @@ class ResultSetImpl {
105
106
  let converter;
106
107
  const userConverter = metadata.converter;
107
108
 
108
- // If IsJson is set convert to JSON objects unless
109
+ // If IsJson or IsOson is set, convert to JSON objects unless
109
110
  // user defined output type handler overwrites it.
110
- if (future.oldJsonColumnAsObj && metadata.isJson && metadata.dbType !== types.DB_TYPE_JSON
111
+ if (metadata.dbType !== types.DB_TYPE_JSON && future.oldJsonColumnAsObj
111
112
  && userConverter === undefined) {
112
- const outConverter = async function(val) {
113
- if (!val) {
114
- return val;
115
- }
113
+ let outConverter;
114
+ if (metadata.isOson) {
115
+ outConverter = async function(val) {
116
+ if (!val) {
117
+ return val;
118
+ }
119
+ let result = val;
120
+ if (val instanceof Lob) {
121
+ result = await val.getData();
122
+ }
123
+ const decoder = new oson.OsonDecoder(result);
124
+ return decoder.decode();
125
+ };
126
+ converter = outConverter;
127
+ } else if (metadata.isJson) {
128
+ outConverter = async function(val) {
129
+ if (!val) {
130
+ return val;
131
+ }
116
132
 
117
- let result = val;
118
- if (val instanceof Lob) {
119
- result = await val.getData();
120
- }
121
- if (result instanceof Buffer) {
122
- result = result.toString();
123
- }
124
- result = JSON.parse(result);
125
- return result;
126
- };
127
- converter = outConverter;
133
+ let result = val;
134
+ if (val instanceof Lob) {
135
+ result = await val.getData();
136
+ }
137
+ if (result instanceof Buffer) {
138
+ result = result.toString();
139
+ }
140
+ result = JSON.parse(result);
141
+ return result;
142
+ };
143
+ converter = outConverter;
144
+ }
128
145
  }
129
146
 
130
147
  // in thin mode, Oracle NUMBER values are internally fetched as string in
package/lib/lob.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2016, 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -50,7 +50,7 @@ class Lob extends Duplex {
50
50
  // not already been closed (never called directly)
51
51
  async _destroy(err, cb) {
52
52
  // if LOB was already closed, nothing to do!
53
- if (err && err.message.startsWith("NJS-108:"))
53
+ if (err && err.message.startsWith("NJS-003:"))
54
54
  delete this._impl;
55
55
  if (this._impl) {
56
56
  const lobImpl = this._impl;
@@ -185,12 +185,28 @@ class Lob extends Duplex {
185
185
  //---------------------------------------------------------------------------
186
186
  // getData()
187
187
  //
188
- // Returns all of the data in the LOB as a single string or buffer.
188
+ // Return a portion (or all) of the data in the LOB. Note that the amount
189
+ // and offset are in bytes for BLOB and BFILE type LOBs and in UCS - 2 code
190
+ // points for CLOB and NCLOB type LOBs.UCS-2 code points are equivalent
191
+ // to characters for all but supplemental characters.If supplemental
192
+ // characters are in the LOB, the offset and amount will have to be chosen
193
+ // carefully to avoid splitting a character.
194
+ // Returns data in the LOB as a single string or buffer.
189
195
  //---------------------------------------------------------------------------
190
- async getData() {
191
- errors.assertArgCount(arguments, 0, 0);
196
+ async getData(offset, amount) {
197
+ errors.assertArgCount(arguments, 0, 2);
198
+ if (offset === undefined) {
199
+ offset = 1;
200
+ } else {
201
+ errors.assertParamValue(Number.isInteger(offset) && offset > 0, 1);
202
+ }
203
+ if (amount === undefined) {
204
+ amount = 0;
205
+ } else {
206
+ errors.assertParamValue(Number.isInteger(amount) && amount > 0, 2);
207
+ }
192
208
  errors.assert(this._impl, errors.ERR_INVALID_LOB);
193
- return await this._impl.getData();
209
+ return await this._impl.getData(offset, amount);
194
210
  }
195
211
 
196
212
  //---------------------------------------------------------------------------
package/lib/oracledb.js CHANGED
@@ -368,6 +368,13 @@ async function _verifyOptions(options, inCreatePool) {
368
368
  outOptions.poolPingInterval = options.poolPingInterval;
369
369
  }
370
370
 
371
+ // poolPingTimeout must be an integer (>= 0)
372
+ if (options.poolPingTimeout !== undefined) {
373
+ errors.assertParamPropValue(Number.isInteger(options.poolPingTimeout) &&
374
+ options.poolPingTimeout >= 0, 1, "poolPingTimeout");
375
+ outOptions.poolPingTimeout = options.poolPingTimeout;
376
+ }
377
+
371
378
  // homogeneous must be a boolean (and defaults to True)
372
379
  outOptions.homogeneous = true;
373
380
  if (options.homogeneous !== undefined) {
@@ -558,6 +565,7 @@ async function createPool(options) {
558
565
  "poolIncrement",
559
566
  "poolTimeout",
560
567
  "poolPingInterval",
568
+ "poolPingTimeout",
561
569
  "queueMax",
562
570
  "queueTimeout");
563
571
 
@@ -880,6 +888,7 @@ module.exports = {
880
888
  DB_TYPE_TIMESTAMP_TZ: types.DB_TYPE_TIMESTAMP_TZ,
881
889
  DB_TYPE_VARCHAR: types.DB_TYPE_VARCHAR,
882
890
  DB_TYPE_XMLTYPE: types.DB_TYPE_XMLTYPE,
891
+ DB_TYPE_VECTOR: types.DB_TYPE_VECTOR,
883
892
 
884
893
  // fetchInfo type defaulting
885
894
  DEFAULT: constants.DEFAULT,
@@ -1011,6 +1020,11 @@ module.exports = {
1011
1020
  TPC_END_NORMAL: constants.TPC_END_NORMAL,
1012
1021
  TPC_END_SUSPEND: constants.TPC_END_SUSPEND,
1013
1022
 
1023
+ // vector types
1024
+ VECTOR_FORMAT_FLOAT32: constants.VECTOR_FORMAT_FLOAT32,
1025
+ VECTOR_FORMAT_FLOAT64: constants.VECTOR_FORMAT_FLOAT64,
1026
+ VECTOR_FORMAT_INT8: constants.VECTOR_FORMAT_INT8,
1027
+
1014
1028
  // database type aliases
1015
1029
  BLOB: types.DB_TYPE_BLOB,
1016
1030
  BUFFER: types.DB_TYPE_RAW,
@@ -1113,6 +1127,10 @@ module.exports = {
1113
1127
  return settings.poolPingInterval;
1114
1128
  },
1115
1129
 
1130
+ get poolPingTimeout() {
1131
+ return settings.poolPingTimeout;
1132
+ },
1133
+
1116
1134
  get poolTimeout() {
1117
1135
  return settings.poolTimeout;
1118
1136
  },
@@ -1251,6 +1269,12 @@ module.exports = {
1251
1269
  settings.poolPingInterval = value;
1252
1270
  },
1253
1271
 
1272
+ set poolPingTimeout(value) {
1273
+ errors.assertPropValue(Number.isInteger(value) && value >= 0,
1274
+ "poolPingTimeout");
1275
+ settings.poolPingTimeout = value;
1276
+ },
1277
+
1254
1278
  set poolTimeout(value) {
1255
1279
  errors.assertPropValue(Number.isInteger(value) && value >= 0,
1256
1280
  "poolTimeout");
package/lib/pool.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2016, 2022, Oracle and/or its affiliates.
1
+ // Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -628,6 +628,15 @@ class Pool extends EventEmitter {
628
628
  return this._impl.getPoolPingInterval();
629
629
  }
630
630
 
631
+ //---------------------------------------------------------------------------
632
+ // poolPingTimeout
633
+ //
634
+ // Property for the ping timeout associated with the pool.
635
+ //---------------------------------------------------------------------------
636
+ get poolPingTimeout() {
637
+ return this._impl.getPoolPingTimeout();
638
+ }
639
+
631
640
  //---------------------------------------------------------------------------
632
641
  // poolTimeout
633
642
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2021, 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2021, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -72,6 +72,7 @@ class PoolStatistics {
72
72
  this.poolMaxPerShard = pool.poolMaxPerShard;
73
73
  this.poolMin = pool.poolMin;
74
74
  this.poolPingInterval = pool.poolPingInterval;
75
+ this.poolPingTimeout = pool.poolPingTimeout;
75
76
  this.poolTimeout = pool.poolTimeout;
76
77
  this.queueMax = pool.queueMax;
77
78
  this.queueTimeout = pool.queueTimeout;
@@ -124,6 +125,7 @@ class PoolStatistics {
124
125
  console.log('...poolMaxPerShard:', this.poolMaxPerShard);
125
126
  console.log('...poolMin:', this.poolMin);
126
127
  console.log('...poolPingInterval (seconds):', this.poolPingInterval);
128
+ console.log('...poolPingTimeout (milliseconds):', this.poolPingTimeout);
127
129
  console.log('...poolTimeout (seconds):', this.poolTimeout);
128
130
  console.log('...queueMax:', this.queueMax);
129
131
  console.log('...queueTimeout (milliseconds):', this.queueTimeout);
package/lib/settings.js CHANGED
@@ -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,6 +29,8 @@
29
29
  const constants = require('./constants.js');
30
30
  const errors = require('./errors.js');
31
31
  const types = require('./types.js');
32
+ const nodbUtil = require("./util.js");
33
+ const vector = require('./impl/datahandlers/vector.js');
32
34
 
33
35
  class Settings {
34
36
 
@@ -51,6 +53,7 @@ class Settings {
51
53
  this.poolMaxPerShard = 0;
52
54
  this.poolMin = 0;
53
55
  this.poolPingInterval = 60;
56
+ this.poolPingTimeout = 5000;
54
57
  this.poolTimeout = 60;
55
58
  this.prefetchRows = 2;
56
59
  this.queueTimeout = 60000;
@@ -105,11 +108,29 @@ class Settings {
105
108
  // information).
106
109
  //---------------------------------------------------------------------------
107
110
  _makeDate(useLocal, year, month, day, hour, minute, second, fseconds, offset) {
108
- if (useLocal) {
109
- return new Date(year, month - 1, day, hour, minute, second, fseconds);
110
- }
111
- return new Date(Date.UTC(year, month - 1, day, hour, minute, second,
112
- fseconds) - offset * 60000);
111
+ return nodbUtil.makeDate(useLocal, year, month, day, hour, minute, second, fseconds, offset);
112
+ }
113
+
114
+ //---------------------------------------------------------------------------
115
+ // _decodeVector()
116
+ //
117
+ // Returns a typed array by decoding buffer.
118
+ //
119
+ //---------------------------------------------------------------------------
120
+ _decodeVector(buffer) {
121
+ const decoder = new vector.VectorDecoder(buffer);
122
+ return decoder.decode();
123
+ }
124
+
125
+ //---------------------------------------------------------------------------
126
+ // _encodeVector()
127
+ //
128
+ // Create a Vector image from typedarray
129
+ //
130
+ //---------------------------------------------------------------------------
131
+ _encodeVector(value) {
132
+ const encoder = new vector.VectorEncoder();
133
+ return encoder.encode(value);
113
134
  }
114
135
 
115
136
  //---------------------------------------------------------------------------
@@ -159,6 +180,9 @@ class Settings {
159
180
  map.set(types.DB_TYPE_CLOB, types.DB_TYPE_LONG);
160
181
  map.set(types.DB_TYPE_NCLOB, types.DB_TYPE_LONG_NVARCHAR);
161
182
  break;
183
+ case types.DB_TYPE_VECTOR:
184
+ map.set(types.DB_TYPE_VECTOR, types.DB_TYPE_LONG);
185
+ break;
162
186
  case types.DB_TYPE_RAW:
163
187
  map.set(types.DB_TYPE_RAW, types.DB_TYPE_VARCHAR);
164
188
  break;
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2018, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -60,6 +60,19 @@ class SodaDocCursor {
60
60
  }
61
61
  }
62
62
 
63
+ [Symbol.asyncIterator]() {
64
+ const cursor = this;
65
+ return {
66
+ async next() {
67
+ const doc = await cursor.getNext();
68
+ return {value: doc, done: doc === undefined};
69
+ },
70
+ return() {
71
+ return {done: true};
72
+ }
73
+ };
74
+ }
75
+
63
76
  }
64
77
 
65
78
  nodbUtil.wrapFns(SodaDocCursor.prototype,