oracledb 6.0.2 → 6.1.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 (67) hide show
  1. package/README.md +15 -17
  2. package/SECURITY.md +1 -1
  3. package/build/Release/oracledb-6.1.0-darwin-x64.node +0 -0
  4. package/build/Release/oracledb-6.1.0-darwin-x64.node-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-6.1.0-js-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.1.0-linux-arm64.node +0 -0
  7. package/build/Release/oracledb-6.1.0-linux-arm64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-6.1.0-linux-x64.node +0 -0
  9. package/build/Release/oracledb-6.1.0-linux-x64.node-buildinfo.txt +1 -0
  10. package/build/Release/oracledb-6.1.0-win32-x64.node +0 -0
  11. package/build/Release/oracledb-6.1.0-win32-x64.node-buildinfo.txt +1 -0
  12. package/examples/example.js +0 -1
  13. package/lib/aqQueue.js +40 -26
  14. package/lib/connection.js +15 -3
  15. package/lib/errors.js +15 -10
  16. package/lib/impl/connection.js +9 -0
  17. package/lib/impl/resultset.js +7 -4
  18. package/lib/oracledb.js +15 -12
  19. package/lib/pool.js +11 -2
  20. package/lib/settings.js +1 -1
  21. package/lib/sodaCollection.js +1 -1
  22. package/lib/thin/connection.js +92 -30
  23. package/lib/thin/dbObject.js +2 -2
  24. package/lib/thin/lob.js +2 -2
  25. package/lib/thin/pool.js +153 -71
  26. package/lib/thin/protocol/buffer.js +24 -6
  27. package/lib/thin/protocol/constants.js +8 -18
  28. package/lib/thin/protocol/encryptDecrypt.js +17 -17
  29. package/lib/thin/protocol/messages/auth.js +27 -31
  30. package/lib/thin/protocol/messages/base.js +30 -53
  31. package/lib/thin/protocol/messages/connectionCookie.js +76 -0
  32. package/lib/thin/protocol/messages/dataType.js +13 -9
  33. package/lib/thin/protocol/messages/execute.js +11 -11
  34. package/lib/thin/protocol/messages/index.js +2 -0
  35. package/lib/thin/protocol/messages/lobOp.js +3 -3
  36. package/lib/thin/protocol/messages/protocol.js +31 -20
  37. package/lib/thin/protocol/messages/withData.js +60 -53
  38. package/lib/thin/protocol/oson.js +4 -4
  39. package/lib/thin/protocol/packet.js +51 -28
  40. package/lib/thin/protocol/protocol.js +12 -7
  41. package/lib/thin/protocol/utils.js +2 -2
  42. package/lib/thin/resultSet.js +6 -6
  43. package/lib/thin/sqlnet/connStrategy.js +134 -7
  44. package/lib/thin/sqlnet/constants.js +2 -0
  45. package/lib/thin/sqlnet/ezConnectResolver.js +29 -24
  46. package/lib/thin/sqlnet/navNodes.js +35 -28
  47. package/lib/thin/sqlnet/networkSession.js +45 -40
  48. package/lib/thin/sqlnet/ntTcp.js +70 -35
  49. package/lib/thin/sqlnet/nvStrToNvPair.js +16 -16
  50. package/lib/thin/sqlnet/packet.js +17 -10
  51. package/lib/thin/sqlnet/paramParser.js +9 -9
  52. package/lib/thin/sqlnet/sessionAtts.js +4 -0
  53. package/lib/thin/statement.js +4 -3
  54. package/lib/thin/util.js +28 -8
  55. package/lib/transformer.js +3 -1
  56. package/lib/util.js +0 -13
  57. package/lib/version.js +2 -2
  58. package/package.json +1 -1
  59. package/build/Release/oracledb-6.0.2-darwin-x64.node +0 -0
  60. package/build/Release/oracledb-6.0.2-darwin-x64.node-buildinfo.txt +0 -1
  61. package/build/Release/oracledb-6.0.2-js-buildinfo.txt +0 -1
  62. package/build/Release/oracledb-6.0.2-linux-arm64.node +0 -0
  63. package/build/Release/oracledb-6.0.2-linux-arm64.node-buildinfo.txt +0 -1
  64. package/build/Release/oracledb-6.0.2-linux-x64.node +0 -0
  65. package/build/Release/oracledb-6.0.2-linux-x64.node-buildinfo.txt +0 -1
  66. package/build/Release/oracledb-6.0.2-win32-x64.node +0 -0
  67. package/build/Release/oracledb-6.0.2-win32-x64.node-buildinfo.txt +0 -1
@@ -42,7 +42,7 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
42
42
  this.connectDataLen = connectData.length;
43
43
  this.overflow = false;
44
44
 
45
- let size, options;
45
+ let size;
46
46
 
47
47
  if (this.connectDataLen <= MAX_CDATA_LEN) {
48
48
  size = NSPCNL + this.connectDataLen;
@@ -52,7 +52,7 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
52
52
  }
53
53
 
54
54
  /* Building Connect Packet */
55
- this.buf = Buffer.alloc(size);
55
+ this.buf = Buffer.allocUnsafe(size).fill(0);
56
56
  this.buf.writeUInt16BE(size, constants.NSPHDLEN);
57
57
  this.buf.writeUInt8(flags, constants.NSPHDFLGS);
58
58
  this.buf.writeUInt8(constants.NSPTCN, constants.NSPHDTYP);
@@ -69,7 +69,7 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
69
69
  /* Options:
70
70
  Note : Node JS does not support TCP Out-of-band so not setting NSGSENDATTN or NSGRECVATTN
71
71
  */
72
- options = constants.NSGDONTCARE;
72
+ const options = constants.NSGDONTCARE;
73
73
  //options = options | constants.NSGUSEVIO /* Vectored I/O support.Uncomment when support is added */
74
74
  this.buf.writeUInt16BE(options, constants.NSPCNOPT);
75
75
 
@@ -142,24 +142,24 @@ function ConnectPacket(connectData, sAtts, flags = 0) {
142
142
  * @param {int} size of Data Packet
143
143
  * @param {boolean} isLargeSDU Large SDU
144
144
  */
145
- function DataPacket(size, isLargeSDU) {
145
+ function DataPacket(isLargeSDU) {
146
146
  this.dataPtr = 0; /* data offset start */
147
147
  this.dataLen = 0; /* data offset end */
148
- this.bufLen = size; /* Length of buffer */
149
148
  this.offset = 0; /* Offset for buffer read/write (fastpath) */
150
149
  this.len = 0; /* Length of buffer read/write (fastpath) */
150
+ this.bufLen = 0; /* Length of buffer */
151
151
 
152
152
  /**
153
153
  * Create the Data Packet(Internal)
154
154
  */
155
- this.createPacket = function() {
155
+ this.createPacket = function(len) {
156
156
  /* Building Data Packet */
157
157
  this.dataPtr = constants.NSPDADAT;
158
158
  this.dataLen = constants.NSPDADAT;
159
-
160
- this.buf = Buffer.alloc(size);
159
+ this.buf = Buffer.allocUnsafe(len).fill(0);
161
160
  this.buf.writeUInt8(0, constants.NSPHDFLGS);
162
161
  this.buf.writeUInt8(constants.NSPTDA, constants.NSPHDTYP);
162
+ this.bufLen = len; /* Length of buffer */
163
163
  };
164
164
 
165
165
  /**
@@ -173,7 +173,7 @@ function DataPacket(size, isLargeSDU) {
173
173
  let bytes2Copy;
174
174
 
175
175
  if (!this.buf) {
176
- this.createPacket();
176
+ this.createPacket(len + constants.NSPDADAT); //Currently NS data packets are being used only in the connect/disconnect phase
177
177
  }
178
178
 
179
179
  if (len > this.bufLen - this.dataLen) {
@@ -245,6 +245,13 @@ function AcceptPacket(packet, sAtts) {
245
245
  /* Accept flags */
246
246
  this.flag0 = packet.buf.readUInt8(constants.NSPACFL0);
247
247
  this.flag1 = packet.buf.readUInt8(constants.NSPACFL1);
248
+
249
+ /* UUID - CDB Instance ID */
250
+ if (sAtts.version >= constants.TNS_VERSION_MIN_UUID) {
251
+ packet.dbUUID = packet.buf.subarray(constants.TNS_UUID_OFFSET,
252
+ constants.TNS_UUID_OFFSET + 16);
253
+ packet.dbUUID = packet.dbUUID.toString('base64');
254
+ }
248
255
  }
249
256
 
250
257
  /**
@@ -377,7 +384,7 @@ function ControlPacket() {
377
384
  } else if (err1 == NSESENDMESG) {
378
385
  this.errno = err1;
379
386
  this.notifLen = err2;
380
- this.notif = Buffer.alloc(err2 + 1);
387
+ this.notif = Buffer.allocUnsafe(err2 + 1).fill(0);
381
388
  this.buf.copy(this.notif, 0, constants.NSPCTLDAT + 12, constants.NSPCTLDAT + 12 + err2);
382
389
  } else {
383
390
  this.errno = err1;
@@ -37,7 +37,7 @@ const errors = require("../../errors.js");
37
37
  */
38
38
  function tnsnamesFilePath(configDir) {
39
39
  let filePathVal = null;
40
- let tnsAdminVal = process.env.TNS_ADMIN;
40
+ const tnsAdminVal = process.env.TNS_ADMIN;
41
41
  if (configDir) {
42
42
  filePathVal = configDir + '/tnsnames.ora';
43
43
  if (fs.existsSync(filePathVal)) {
@@ -69,7 +69,7 @@ class NLParamParser {
69
69
  * @returns {Promise}
70
70
  */
71
71
  async initializeNlpa(file_path) {
72
- let stat = fs.statSync(file_path);
72
+ const stat = fs.statSync(file_path);
73
73
 
74
74
  if (!(stat.mtime - prevmtime)) {
75
75
  /* File has been read */
@@ -139,10 +139,10 @@ class NLParamParser {
139
139
  * @return String The modified String returned
140
140
  */
141
141
  checkNLPforComments(str) {
142
- let str1 = new Array(str.length);
142
+ const str1 = new Array(str.length);
143
143
 
144
144
  for (let i = 0; i < str.length; i++) {
145
- let current_char = str[i];
145
+ const current_char = str[i];
146
146
  if (current_char == '#') {
147
147
  if (i != 0) {
148
148
  break; // No need to continue. Return the line
@@ -160,14 +160,14 @@ class NLParamParser {
160
160
  * @param {string} ibuf
161
161
  */
162
162
  addNLPListElement(ibuf) {
163
- let res = ibuf.split(/\r?\n/).filter(element => element);
163
+ const res = ibuf.split(/\r?\n/).filter(element => element);
164
164
  for (let i = 0; i < res.length; i++) {
165
165
  if (res[i].charAt(0) != '(') {
166
166
  res[i] = '(' + res[i] + ')';
167
167
  }
168
- let nvp = createNVPair(res[i]);
169
- let name = nvp.name;
170
- let uname = name.toUpperCase();
168
+ const nvp = createNVPair(res[i]);
169
+ const name = nvp.name;
170
+ const uname = name.toUpperCase();
171
171
  nvp.name = uname;
172
172
  const unames = uname.split(","); //multiple aliases (alias1, alias2, alias3)
173
173
  for (let i = 0; i < unames.length; i++) {
@@ -191,7 +191,7 @@ class NLParamParser {
191
191
  * @returns {string}
192
192
  */
193
193
  findValueOf(key) {
194
- let myarr = key.split('/');
194
+ const myarr = key.split('/');
195
195
  return (findValue(this.ht.get(myarr[0].toUpperCase()), myarr));
196
196
  }
197
197
 
@@ -59,6 +59,7 @@ class SessionAtts {
59
59
  this.nt.tcpNoDelay = true;
60
60
  this.uuid = uuid;
61
61
  this.nt.sslServerDNMatch = true;
62
+ this.nt.sslAllowWeakDNMatch = false;
62
63
  }
63
64
 
64
65
  /**
@@ -100,6 +101,9 @@ class SessionAtts {
100
101
  if (typeof params.sslServerDNMatch === 'boolean') {
101
102
  this.nt.sslServerDNMatch = params.sslServerDNMatch;
102
103
  }
104
+ if (typeof params.sslAllowWeakDNMatch === 'boolean') {
105
+ this.nt.sslAllowWeakDNMatch = params.sslAllowWeakDNMatch;
106
+ }
103
107
  if (typeof params.sslServerCertDN === 'string') {
104
108
  this.nt.sslServerCertDN = params.sslServerCertDN;
105
109
  }
@@ -93,6 +93,7 @@ class Statement {
93
93
  this.queryVars = [];
94
94
  this.bindInfoDict = new Map();
95
95
  this.requiresFullExecute = false;
96
+ this.noPrefetch = false;
96
97
  this.returnToCache = false;
97
98
  this.numColumns = 0;
98
99
  this.lastRowIndex;
@@ -144,7 +145,7 @@ class Statement {
144
145
  //---------------------------------------------------------------------------
145
146
  _determineStatementType(sql) {
146
147
  sql = thinUtil.cleanSql(sql);
147
- let tokens = sql.trim().trimStart('(').substring(0, 10).split(" ");
148
+ const tokens = sql.trim().trimStart('(').substring(0, 10).split(" ");
148
149
  if (tokens.length > 0) {
149
150
  const sqlKeyword = tokens[0].toUpperCase();
150
151
  if (["DECLARE", "BEGIN", "CALL"].includes(sqlKeyword)) {
@@ -220,7 +221,7 @@ class Statement {
220
221
  let result;
221
222
  let intoKey = -1;
222
223
  const retKey = sql.search(DML_RETURNING_KEY);
223
- let intoRegex = DML_RETURNING_INTO_KEY;
224
+ const intoRegex = DML_RETURNING_INTO_KEY;
224
225
  // simulate lastInfdexOf with intoRegex input
225
226
  while ((result = intoRegex.exec(sql.slice(retKey))) != null) {
226
227
  intoKey = result.index;
@@ -258,7 +259,7 @@ class Statement {
258
259
  if (this.isPlSql && this.bindInfoDict.has(name)) {
259
260
  return;
260
261
  }
261
- let info = new BindInfo(name, isReturnBind);
262
+ const info = new BindInfo(name, isReturnBind);
262
263
  this.bindInfoList.push(info);
263
264
 
264
265
  if (this.bindInfoDict.has(info.bindName)) {
package/lib/thin/util.js CHANGED
@@ -28,6 +28,26 @@
28
28
 
29
29
  const constants = require('../constants');
30
30
  const errors = require('../errors.js');
31
+ const os = require('os');
32
+
33
+ //---------------------------------------------------------------------------
34
+ // populateClientInfo()
35
+ //
36
+ // Populates client process information
37
+ //---------------------------------------------------------------------------
38
+ function populateClientInfo() {
39
+ this.program = process.argv0;
40
+ this.terminal = "unknown";
41
+ this.pid = process.pid.toString();
42
+ try {
43
+ this.userName = os.userInfo().username;
44
+ } catch {
45
+ this.userName = "unknown";
46
+ }
47
+ this.hostName = os.hostname();
48
+ }
49
+ // Initialize client data on startup.
50
+ const CLIENT_INFO = new populateClientInfo();
31
51
 
32
52
  //---------------------------------------------------------------------------
33
53
  // getMetadataMany(sql)
@@ -48,7 +68,7 @@ function getMetadataMany(vars) {
48
68
  // Get the outBinds for the sql
49
69
  //---------------------------------------------------------------------------
50
70
  function getOutBinds(bindVars, pos) {
51
- let bindByPos = (bindVars[0].name === undefined);
71
+ const bindByPos = (bindVars[0].name === undefined);
52
72
  let outBinds;
53
73
  if (bindByPos) {
54
74
  outBinds = [];
@@ -73,11 +93,11 @@ function getOutBinds(bindVars, pos) {
73
93
  // Get the outBinds for the sql when doing an executeMany call
74
94
  //---------------------------------------------------------------------------
75
95
  function getExecuteManyOutBinds(bindVars, numIters) {
76
- let numOutBinds = getNumOutBinds(bindVars);
96
+ const numOutBinds = getNumOutBinds(bindVars);
77
97
  if (numOutBinds === 0) {
78
98
  return;
79
99
  }
80
- let outBinds = new Array(numIters).fill(null);
100
+ const outBinds = new Array(numIters).fill(null);
81
101
  for (let i = 0; i < numIters; i++) {
82
102
  outBinds[i] = getOutBinds(bindVars, i);
83
103
  }
@@ -105,7 +125,7 @@ function getNumOutBinds(bindVars) {
105
125
  // Get the outBinds for the sql when doing an execute call
106
126
  //---------------------------------------------------------------------------
107
127
  function getExecuteOutBinds(bindVars) {
108
- let numOutBinds = getNumOutBinds(bindVars);
128
+ const numOutBinds = getNumOutBinds(bindVars);
109
129
  if (numOutBinds === 0) {
110
130
  return;
111
131
  }
@@ -131,7 +151,7 @@ function cleanSql(sql) {
131
151
  // Get the bind variables from the bindInfoList of the statement object
132
152
  //---------------------------------------------------------------------------
133
153
  function getBindVars(statement) {
134
- let bindVars = [];
154
+ const bindVars = [];
135
155
  for (const bindInfo of statement.bindInfoList) {
136
156
  bindVars.push(bindInfo.bindVar);
137
157
  }
@@ -147,8 +167,7 @@ function checkProxyUserValidity(userName) {
147
167
  let schemaUser = '', proxyUser = '';
148
168
  let quoteFound = false, openSquareBracketFound = false;
149
169
  let lastQuoteFoundIndex = 0;
150
- let schemaUserStartIndex;
151
- let result = {
170
+ const result = {
152
171
  status : -1,
153
172
  proxyUser : '',
154
173
  schemaUser : ''
@@ -199,7 +218,7 @@ function checkProxyUserValidity(userName) {
199
218
  // extract schema user
200
219
  index = index + 1;
201
220
  quoteFound = false;
202
- schemaUserStartIndex = index;
221
+ const schemaUserStartIndex = index;
203
222
  lastQuoteFoundIndex = 0;
204
223
  while (index < userNameLength) {
205
224
  // check for double quotes
@@ -280,6 +299,7 @@ function checkCredentials(params) {
280
299
  module.exports = {
281
300
  getMetadataMany,
282
301
  cleanSql,
302
+ CLIENT_INFO,
283
303
  getExecuteOutBinds,
284
304
  getExecuteManyOutBinds,
285
305
  getOutBinds,
@@ -248,5 +248,7 @@ function transformValueIn(info, value, options) {
248
248
 
249
249
  // define exports
250
250
  module.exports = {
251
- transformValueIn,
251
+ transformJsonValue,
252
+ transformValueIn
253
+
252
254
  };
package/lib/util.js CHANGED
@@ -294,18 +294,6 @@ function isTokenValid(accessToken) {
294
294
  }
295
295
  }
296
296
 
297
- function isPrivateKeyValid(accessToken) {
298
- errors.assert(typeof accessToken.privateKey === 'string',
299
- errors.ERR_TOKEN_BASED_AUTH);
300
-
301
- if (accessToken.privateKey.startsWith("-----BEGIN PRIVATE KEY-----") ||
302
- accessToken.privateKey.endsWith("-----END PRIVATE KEY-----")) {
303
- return false;
304
- }
305
-
306
- return true;
307
- }
308
-
309
297
  //-----------------------------------------------------------------------------
310
298
  // addTypeProperties()
311
299
  //
@@ -342,7 +330,6 @@ module.exports = {
342
330
  isArrayOfStrings,
343
331
  isObject,
344
332
  isObjectOrArray,
345
- isPrivateKeyValid,
346
333
  isShardingKey,
347
334
  isSodaDocument,
348
335
  isTokenExpired,
package/lib/version.js CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  module.exports = {
32
32
  VERSION_MAJOR: 6,
33
- VERSION_MINOR: 0,
34
- VERSION_PATCH: 2,
33
+ VERSION_MINOR: 1,
34
+ VERSION_PATCH: 0,
35
35
  VERSION_SUFFIX: ''
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "A Node.js module for Oracle Database access from JavaScript and TypeScript",
5
5
  "license": "(Apache-2.0 OR UPL-1.0)",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
@@ -1 +0,0 @@
1
- oracledb-6.0.2-darwin-x64.node v18.16.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:14:06 GMT
@@ -1 +0,0 @@
1
- 5caec79c2095133bc3d39b0e08d0d7a7952a4352
@@ -1 +0,0 @@
1
- oracledb-6.0.2-linux-arm64.node v14.16.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 16:56:30 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.2-linux-x64.node v16.20.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:29:14 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.2-win32-x64.node v16.19.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:13:50 GMT