oracledb 6.5.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 (32) hide show
  1. package/README.md +2 -2
  2. package/build/Release/{oracledb-6.5.0-darwin-x64.node → 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/errors.js +12 -0
  13. package/lib/impl/datahandlers/buffer.js +2 -2
  14. package/lib/oracledb.js +7 -34
  15. package/lib/pool.js +7 -0
  16. package/lib/thin/protocol/constants.js +1 -0
  17. package/lib/thin/protocol/messages/withData.js +11 -2
  18. package/lib/thin/protocol/protocol.js +4 -0
  19. package/lib/thin/sqlnet/packet.js +3 -1
  20. package/lib/thin/statement.js +4 -0
  21. package/lib/thin/statementCache.js +5 -0
  22. package/lib/util.js +28 -0
  23. package/lib/version.js +1 -1
  24. package/package.json +1 -1
  25. package/build/Release/oracledb-6.5.0-darwin-x64.node-buildinfo.txt +0 -1
  26. package/build/Release/oracledb-6.5.0-js-buildinfo.txt +0 -1
  27. package/build/Release/oracledb-6.5.0-linux-arm64.node +0 -0
  28. package/build/Release/oracledb-6.5.0-linux-arm64.node-buildinfo.txt +0 -1
  29. package/build/Release/oracledb-6.5.0-linux-x64.node +0 -0
  30. package/build/Release/oracledb-6.5.0-linux-x64.node-buildinfo.txt +0 -1
  31. package/build/Release/oracledb-6.5.0-win32-x64.node +0 -0
  32. package/build/Release/oracledb-6.5.0-win32-x64.node-buildinfo.txt +0 -1
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # node-oracledb version 6.5.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.5.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/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;
@@ -695,6 +706,7 @@ function transformErr(err, fnOpt) {
695
706
 
696
707
  // define exports
697
708
  module.exports = {
709
+ ERR_INTEGRITY_ERROR_CODES,
698
710
  ERR_INVALID_POOL,
699
711
  ERR_INVALID_CONNECTION,
700
712
  ERR_INVALID_PROPERTY_VALUE,
@@ -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
 
package/lib/oracledb.js CHANGED
@@ -118,33 +118,6 @@ function _initializeThinDriver() {
118
118
  require('./thin');
119
119
  }
120
120
 
121
- //---------------------------------------------------------------------------
122
- // _isPrivilege()
123
- //
124
- // Returns a boolean indicating if the supplied value is a valid privilege.
125
- //---------------------------------------------------------------------------
126
- function _isPrivilege(value) {
127
- // Privileges are mutually exclusive and cannot be specified together
128
- // except SYSPRELIM, which cannot be specified alone, it is specified in a
129
- // combo with SYSOPER or SYSDBA. SYSPRELIM is used only for
130
- // startup/shutdown
131
-
132
- // If SYSPRELIM specified, clear the bit
133
- if (value & constants.SYSPRELIM) {
134
- value = value ^ constants.SYSPRELIM;
135
- }
136
-
137
- return (
138
- value === constants.SYSASM ||
139
- value === constants.SYSBACKUP ||
140
- value === constants.SYSDBA ||
141
- value === constants.SYSDG ||
142
- value === constants.SYSKM ||
143
- value === constants.SYSOPER ||
144
- value === constants.SYSRAC
145
- );
146
- }
147
-
148
121
  //-----------------------------------------------------------------------------
149
122
  // _verifyOptions()
150
123
  //
@@ -331,6 +304,13 @@ async function _verifyOptions(options, inCreatePool) {
331
304
  outOptions.connectionIdPrefix = options.connectionIdPrefix;
332
305
  }
333
306
 
307
+ // privilege must be one of a set of named constants
308
+ if (options.privilege !== undefined) {
309
+ errors.assertParamPropValue(nodbUtil.isPrivilege(options.privilege), 1,
310
+ "privilege");
311
+ outOptions.privilege = options.privilege;
312
+ }
313
+
334
314
  // check pool specific options
335
315
  if (inCreatePool) {
336
316
 
@@ -444,13 +424,6 @@ async function _verifyOptions(options, inCreatePool) {
444
424
  outOptions.newPassword = options.newPassword;
445
425
  }
446
426
 
447
- // privilege must be one of a set of named constants
448
- if (options.privilege !== undefined) {
449
- errors.assertParamPropValue(_isPrivilege(options.privilege), 1,
450
- "privilege");
451
- outOptions.privilege = options.privilege;
452
- }
453
-
454
427
  // shardingKey must be an array of values
455
428
  if (options.shardingKey !== undefined) {
456
429
  const value = options.shardingKey;
package/lib/pool.js CHANGED
@@ -238,6 +238,13 @@ class Pool extends EventEmitter {
238
238
  outOptions.superShardingKey = options.superShardingKey;
239
239
  }
240
240
 
241
+ // privilege must be one of a set of named constants
242
+ if (options.privilege !== undefined) {
243
+ errors.assertParamPropValue(nodbUtil.isPrivilege(options.privilege), 1,
244
+ "privilege");
245
+ outOptions.privilege = options.privilege;
246
+ }
247
+
241
248
  return outOptions;
242
249
  }
243
250
 
@@ -724,6 +724,7 @@ module.exports = {
724
724
  TNS_XML_TYPE_FLAG_SKIP_NEXT_4: 0x100000,
725
725
 
726
726
  // errors
727
+ TNS_ERR_INCONSISTENT_DATA_TYPES: 932,
727
728
  TNS_ERR_VAR_NOT_IN_SELECT_LIST: 1007,
728
729
  TNS_ERR_INBAND_MESSAGE: 12573,
729
730
  TNS_ERR_INVALID_SERVICE_NAME: 12514,
@@ -113,9 +113,18 @@ class MessageWithData extends Message {
113
113
  this.errorInfo.num = 0;
114
114
  this.errorOccurred = false;
115
115
  this.statement.moreRowsToFetch = false;
116
+ } else if (this.retry) {
117
+ this.retry = false;
118
+ } else if (this.statement.isQuery &&
119
+ (this.errorInfo.num === constants.TNS_ERR_VAR_NOT_IN_SELECT_LIST
120
+ || this.errorInfo.num === constants.TNS_ERR_INCONSISTENT_DATA_TYPES)) {
121
+ this.retry = true;
122
+ this.connection.statementCache.clearCursor(this.statement);
116
123
  } else if (this.errorInfo.num !== 0 && this.errorInfo.cursorId !== 0) {
117
- this.connection.statementCache._cachedStatements.delete(this.statement.sql);
118
- this.statement.returnToCache = false;
124
+ if (!errors.ERR_INTEGRITY_ERROR_CODES.includes(this.errorInfo.num)) {
125
+ this.connection.statementCache.clearCursor(this.statement);
126
+ this.statement.returnToCache = false;
127
+ }
119
128
  }
120
129
  if (this.errorInfo.batchErrors) {
121
130
  this.errorOccurred = false;
@@ -174,6 +174,10 @@ class Protocol {
174
174
  if (callTimeoutExpired) {
175
175
  errors.throwErr(errors.ERR_CALL_TIMEOUT_EXCEEDED, this.callTimeout);
176
176
  }
177
+ if (message.retry) {
178
+ message.errorOccurred = false;
179
+ return await this._processMessage(message);
180
+ }
177
181
  let err = new Error(message.errorInfo.message);
178
182
  err.offset = message.errorInfo.pos;
179
183
  err.errorNum = message.errorInfo.num;
@@ -296,7 +296,9 @@ function RedirectPacket(packet) {
296
296
  */
297
297
  function MarkerPacket(isLargeSDU) {
298
298
  this.len = constants.NSPMKDAT + 1; /* Packet length */
299
- this.buf = Buffer.allocUnsafe(constants.NSPMKDAT + 1); /* Packet Buffer */
299
+
300
+ // Packet Buffer
301
+ this.buf = Buffer.allocUnsafe(constants.NSPMKDAT + 1).fill(0);
300
302
 
301
303
  if (isLargeSDU) {
302
304
  this.buf.writeUInt32BE(this.len, constants.NSPHDLEN);
@@ -29,6 +29,7 @@
29
29
  const { Buffer } = require('buffer');
30
30
  const constants = require('../constants');
31
31
  const errors = require('../errors');
32
+ const protoConstants = require('./protocol/constants');
32
33
 
33
34
  /**
34
35
  * It is used to cache the metadata about bind information
@@ -519,6 +520,9 @@ class Statement {
519
520
  // cursor also requires a full execute.
520
521
  //---------------------------------------------------------------------------
521
522
  _setVariable(bindInfo, variable) {
523
+ if (variable.type._oraTypeNum === protoConstants.TNS_DATA_TYPE_CURSOR) {
524
+ this.requiresFullExecute = true;
525
+ }
522
526
  if (variable.maxSize !== bindInfo.maxSize
523
527
  || variable.dir !== bindInfo.dir
524
528
  || variable.isArray !== bindInfo.isArray
@@ -146,6 +146,11 @@ class StatementCache {
146
146
  return stmt;
147
147
  }
148
148
 
149
+ clearCursor(statement) {
150
+ this._addCursorToClose(statement);
151
+ statement.cursorId = 0;
152
+ }
153
+
149
154
  //---------------------------------------------------------------------------
150
155
  // returnStatement()
151
156
  // Return the statement to the statement cache, if applicable. If the
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;
@@ -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
@@ -31,6 +31,6 @@
31
31
  module.exports = {
32
32
  VERSION_MAJOR: 6,
33
33
  VERSION_MINOR: 5,
34
- VERSION_PATCH: 0,
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.5.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.5.0-darwin-x64.node v20.11.1 91a7f419eccbfcd18513c19cd25f55f18a4d8ccc 42edf925eedae73b0d5bd7777167a21987bafc89 Tue, 30 Apr 2024 20:12:57 GMT
@@ -1 +0,0 @@
1
- 91a7f419eccbfcd18513c19cd25f55f18a4d8ccc
@@ -1 +0,0 @@
1
- oracledb-6.5.0-linux-arm64.node v18.19.1 91a7f419eccbfcd18513c19cd25f55f18a4d8ccc 42edf925eedae73b0d5bd7777167a21987bafc89 Wed, 01 May 2024 04:29:37 GMT
@@ -1 +0,0 @@
1
- oracledb-6.5.0-linux-x64.node v16.20.2 91a7f419eccbfcd18513c19cd25f55f18a4d8ccc 42edf925eedae73b0d5bd7777167a21987bafc89 Wed, 01 May 2024 04:22:59 GMT
@@ -1 +0,0 @@
1
- oracledb-6.5.0-win32-x64.node v18.16.0 91a7f419eccbfcd18513c19cd25f55f18a4d8ccc 42edf925eedae73b0d5bd7777167a21987bafc89 Wed, 01 May 2024 04:34:23 GMT