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
@@ -71,20 +71,37 @@ class StatementCache {
71
71
  }
72
72
 
73
73
  //---------------------------------------------------------------------------
74
- //clearOpenCursors() {
74
+ //clearCursors() {
75
75
  // Clears the list of open cursors and removes the list of cursors that
76
76
  // need to be closed. This is required when a DRCP session change has
77
77
  // taken place as the cursor ID values are invalidated.
78
78
  //---------------------------------------------------------------------------
79
- clearOpenCursors() {
79
+ clearCursors() {
80
80
  const newOpenCursors = new Set();
81
81
  for (const stmt of this._openCursors) {
82
- stmt.cursorId = 0;
83
- if (stmt.inUse) {
82
+ if (stmt.inUse || stmt.returnToCache) {
83
+ stmt.pendingClear = true;
84
84
  newOpenCursors.add(stmt);
85
85
  }
86
+ stmt._clearState();
86
87
  }
87
88
  this._openCursors = newOpenCursors;
89
+ this._cursorsToClose.clear();
90
+ }
91
+
92
+ //---------------------------------------------------------------------------
93
+ //clearPendingState() {
94
+ // Clears state for statment with pending clear flag set and not in use.
95
+ // This will clear all state for open cursors.
96
+ // Called after rows processing is completed.
97
+ //---------------------------------------------------------------------------
98
+ clearPendingStatus() {
99
+ for (const stmt of this._openCursors) {
100
+ if (stmt.pendingClear && !stmt.inUse) {
101
+ stmt._clearAllState();
102
+ stmt.pendingClear = false;
103
+ }
104
+ }
88
105
  }
89
106
 
90
107
  //---------------------------------------------------------------------------
@@ -94,14 +111,10 @@ class StatementCache {
94
111
  // supposed to be cached, a copy will be made (and not returned to the
95
112
  // cache).
96
113
  //---------------------------------------------------------------------------
97
- getStatement(sql, cacheStatement = false) {
114
+ getStatement(sql, cacheStatement = false, forceNew = false) {
98
115
  let stmt = null;
99
116
  if (sql) {
100
117
  stmt = this._cachedStatements.get(sql);
101
- if (!cacheStatement) {
102
- this._openCursors.add(stmt);
103
- this._cachedStatements.delete(sql);
104
- }
105
118
  }
106
119
  if (!stmt) {
107
120
  stmt = new Statement();
@@ -114,17 +127,30 @@ class StatementCache {
114
127
  this._adjustCache();
115
128
  }
116
129
  this._openCursors.add(stmt);
117
- } else if (stmt.inUse || !cacheStatement) {
130
+ } else if (forceNew || stmt.inUse) {
131
+ if (!cacheStatement) {
132
+ this._addCursorToClose(stmt);
133
+ this._cachedStatements.delete(sql);
134
+ }
118
135
  stmt = stmt._copy();
119
136
  this._openCursors.add(stmt);
137
+ } else if (!cacheStatement) {
138
+ this._cachedStatements.delete(sql);
139
+ stmt.returnToCache = false;
120
140
  } else {
121
141
  this._cachedStatements.delete(sql);
122
142
  this._cachedStatements.set(sql, stmt);
123
143
  }
144
+ this._openCursors.add(stmt);
124
145
  stmt.inUse = true;
125
146
  return stmt;
126
147
  }
127
148
 
149
+ clearCursor(statement) {
150
+ this._addCursorToClose(statement);
151
+ statement.cursorId = 0;
152
+ }
153
+
128
154
  //---------------------------------------------------------------------------
129
155
  // returnStatement()
130
156
  // Return the statement to the statement cache, if applicable. If the
@@ -146,9 +172,11 @@ class StatementCache {
146
172
  }
147
173
  if (statement.returnToCache) {
148
174
  statement.inUse = false;
149
- } else if (statement.cursorId !== 0) {
175
+ } else {
150
176
  this._addCursorToClose(statement);
151
177
  }
178
+ // clear all state for statement which is having flag set and not in use
179
+ this.clearPendingStatus();
152
180
  }
153
181
 
154
182
  //---------------------------------------------------------------------------
package/lib/thin/util.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
  //
@@ -254,5 +254,5 @@ module.exports = {
254
254
  getOutBinds,
255
255
  checkProxyUserValidity,
256
256
  checkCredentials,
257
- normalizePrivateKey
257
+ normalizePrivateKey,
258
258
  };
@@ -89,7 +89,7 @@ function transformJsonValue(value) {
89
89
  if (value === undefined || value === null ||
90
90
  typeof value === 'number' || typeof value === 'string' ||
91
91
  typeof value === 'boolean' || Buffer.isBuffer(value) ||
92
- util.isDate(value) || nodbUtil.isVectorValue(value))
92
+ util.types.isDate(value) || nodbUtil.isVectorValue(value))
93
93
  return value;
94
94
 
95
95
  // arrays are transformed to a new array with processed values
@@ -105,6 +105,12 @@ function transformJsonValue(value) {
105
105
  if (value instanceof BaseDbObject)
106
106
  return {fields: [], values: []};
107
107
 
108
+ // JsonId is a special type to represent autogenerated id
109
+ // for SODA documents.
110
+ if (value instanceof types.JsonId) {
111
+ return value;
112
+ }
113
+
108
114
  // all other objects are transformed to an object with two arrays (fields
109
115
  // and values)
110
116
  const outValue = {};
@@ -166,7 +172,7 @@ function transformValueIn(info, value, options) {
166
172
  return value;
167
173
 
168
174
  // handle numbers
169
- } else if (typeof value === 'number') {
175
+ } else if (typeof value === 'number' || typeof value === 'bigint') {
170
176
  checkType(info, options,
171
177
  types.DB_TYPE_NUMBER,
172
178
  types.DB_TYPE_BINARY_INTEGER,
@@ -183,7 +189,7 @@ function transformValueIn(info, value, options) {
183
189
  return value;
184
190
 
185
191
  // handle dates
186
- } else if (util.isDate(value)) {
192
+ } else if (util.types.isDate(value)) {
187
193
  checkType(info, options,
188
194
  types.DB_TYPE_TIMESTAMP,
189
195
  types.DB_TYPE_TIMESTAMP_TZ,
package/lib/types.js CHANGED
@@ -332,6 +332,13 @@ dbTypeByColumnTypeName.set("SMALLINT", DB_TYPE_NUMBER);
332
332
  dbTypeByColumnTypeName.set("TIMESTAMP WITH LOCAL TZ", DB_TYPE_TIMESTAMP_LTZ);
333
333
  dbTypeByColumnTypeName.set("TIMESTAMP WITH TZ", DB_TYPE_TIMESTAMP_TZ);
334
334
 
335
+ // It abstracts the autogenerated SODA Document key.
336
+ class JsonId extends Uint8Array {
337
+ toJSON() {
338
+ return (Buffer.from(this.buffer).toString('hex'));
339
+ }
340
+ }
341
+
335
342
  module.exports = {
336
343
  DbType,
337
344
  DB_TYPE_BFILE,
@@ -368,5 +375,6 @@ module.exports = {
368
375
  DB_TYPE_XMLTYPE,
369
376
  getTypeByColumnTypeName,
370
377
  getTypeByNum,
371
- getTypeByOraTypeNum
378
+ getTypeByOraTypeNum,
379
+ JsonId
372
380
  };
package/lib/util.js CHANGED
@@ -31,6 +31,7 @@ const errors = require('./errors.js');
31
31
  const process = require('process');
32
32
  const util = require('util');
33
33
  const types = require('./types.js');
34
+ const constants = require('./constants.js');
34
35
 
35
36
  // node-oracledb version number
36
37
  let packageJSON;
@@ -224,6 +225,32 @@ function isObjectOrArray(value) {
224
225
  return (value !== null && typeof value === 'object') || Array.isArray(value);
225
226
  }
226
227
 
228
+ //---------------------------------------------------------------------------
229
+ // isPrivilege()
230
+ //
231
+ // Returns a boolean indicating if the supplied value is a valid privilege.
232
+ //---------------------------------------------------------------------------
233
+ function isPrivilege(value) {
234
+ // Privileges are mutually exclusive and cannot be specified together
235
+ // except SYSPRELIM, which cannot be specified alone, it is specified in a
236
+ // combo with SYSOPER or SYSDBA. SYSPRELIM is used only for
237
+ // startup/shutdown
238
+
239
+ // If SYSPRELIM specified, clear the bit
240
+ if (value & constants.SYSPRELIM) {
241
+ value = value ^ constants.SYSPRELIM;
242
+ }
243
+ return (
244
+ value === constants.SYSASM ||
245
+ value === constants.SYSBACKUP ||
246
+ value === constants.SYSDBA ||
247
+ value === constants.SYSDG ||
248
+ value === constants.SYSKM ||
249
+ value === constants.SYSOPER ||
250
+ value === constants.SYSRAC
251
+ );
252
+ }
253
+
227
254
  function isShardingKey(value) {
228
255
  if (!Array.isArray(value))
229
256
  return false;
@@ -231,7 +258,7 @@ function isShardingKey(value) {
231
258
  const element = value[i];
232
259
  const ok = typeof element === 'string' ||
233
260
  typeof element === 'number' || Buffer.isBuffer(element) ||
234
- util.isDate(element);
261
+ util.types.isDate(element);
235
262
  if (!ok)
236
263
  return false;
237
264
  }
@@ -369,6 +396,7 @@ module.exports = {
369
396
  isArrayOfStrings,
370
397
  isObject,
371
398
  isObjectOrArray,
399
+ isPrivilege,
372
400
  isShardingKey,
373
401
  isSodaDocument,
374
402
  isTokenExpired,
package/lib/version.js CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  module.exports = {
32
32
  VERSION_MAJOR: 6,
33
- VERSION_MINOR: 4,
34
- VERSION_PATCH: 0,
33
+ VERSION_MINOR: 5,
34
+ VERSION_PATCH: 1,
35
35
  VERSION_SUFFIX: ''
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "6.4.0",
3
+ "version": "6.5.1",
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.4.0-darwin-x64.node v18.17.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 13:53:47 GMT
@@ -1 +0,0 @@
1
- df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1
@@ -1 +0,0 @@
1
- oracledb-6.4.0-linux-arm64.node v18.19.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 15:01:23 GMT
@@ -1 +0,0 @@
1
- oracledb-6.4.0-linux-x64.node v16.20.2 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 14:56:18 GMT
@@ -1 +0,0 @@
1
- oracledb-6.4.0-win32-x64.node v18.16.0 df971fa2503fcf9ab4a63f2f2508f5fb5780c0e1 31cd3b6682f32ad860df63d1dd06e3bf1c5e62aa Thu, 29 Feb 2024 15:35:39 GMT