oracledb 6.0.0 → 6.0.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 (49) hide show
  1. package/README.md +2 -2
  2. package/build/Release/{oracledb-6.0.0-darwin-x64.node → oracledb-6.0.1-darwin-x64.node} +0 -0
  3. package/build/Release/oracledb-6.0.1-darwin-x64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.0.1-js-buildinfo.txt +1 -0
  5. package/build/Release/{oracledb-6.0.0-linux-arm64.node → oracledb-6.0.1-linux-arm64.node} +0 -0
  6. package/build/Release/oracledb-6.0.1-linux-arm64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.0.1-linux-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/{oracledb-6.0.0-win32-x64.node → oracledb-6.0.1-win32-x64.node} +0 -0
  9. package/build/Release/oracledb-6.0.1-win32-x64.node-buildinfo.txt +1 -0
  10. package/examples/README.md +1 -1
  11. package/lib/aqDeqOptions.js +2 -1
  12. package/lib/aqQueue.js +1 -0
  13. package/lib/connection.js +2 -0
  14. package/lib/errors.js +5 -1
  15. package/lib/lob.js +1 -0
  16. package/lib/oracledb.js +1 -1
  17. package/lib/poolStatistics.js +1 -0
  18. package/lib/queryStream.js +2 -1
  19. package/lib/sodaDatabase.js +1 -0
  20. package/lib/thin/connection.js +24 -19
  21. package/lib/thin/dbObject.js +1 -0
  22. package/lib/thin/lob.js +1 -0
  23. package/lib/thin/protocol/buffer.js +5 -2
  24. package/lib/thin/protocol/capabilities.js +8 -3
  25. package/lib/thin/protocol/constants.js +2 -1
  26. package/lib/thin/protocol/encryptDecrypt.js +2 -2
  27. package/lib/thin/protocol/messages/auth.js +1 -0
  28. package/lib/thin/protocol/messages/base.js +1 -0
  29. package/lib/thin/protocol/messages/dataType.js +10 -1
  30. package/lib/thin/protocol/messages/execute.js +1 -1
  31. package/lib/thin/protocol/messages/lobOp.js +2 -1
  32. package/lib/thin/protocol/messages/withData.js +13 -12
  33. package/lib/thin/protocol/oson.js +1 -0
  34. package/lib/thin/protocol/packet.js +3 -4
  35. package/lib/thin/protocol/utils.js +1 -0
  36. package/lib/thin/sqlnet/networkSession.js +5 -4
  37. package/lib/thin/sqlnet/ntTcp.js +2 -0
  38. package/lib/thin/sqlnet/paramParser.js +1 -0
  39. package/lib/thin/statement.js +13 -14
  40. package/lib/transformer.js +10 -8
  41. package/lib/util.js +2 -0
  42. package/lib/version.js +1 -1
  43. package/package.json +1 -1
  44. package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +0 -1
  45. package/build/Release/oracledb-6.0.0-js-buildinfo.txt +0 -1
  46. package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +0 -1
  47. package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +0 -1
  48. package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +0 -1
  49. /package/build/Release/{oracledb-6.0.0-linux-x64.node → oracledb-6.0.1-linux-x64.node} +0 -0
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # node-oracledb version 6.0.0
1
+ # node-oracledb version 6.0.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.0.0 to connect Node.js 14.6, or later, to Oracle
7
+ Use node-oracledb 6.0.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.0.1-darwin-x64.node v16.20.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 22:13:14 GMT
@@ -0,0 +1 @@
1
+ 628884c63240a6680e2dd5a9ff5006cbf373348f
@@ -0,0 +1 @@
1
+ oracledb-6.0.1-linux-arm64.node v16.19.1 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 16:31:07 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.0.1-linux-x64.node v16.20.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Sat, 03 Jun 2023 06:55:38 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.0.1-win32-x64.node v16.19.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 16:39:59 GMT
@@ -108,6 +108,6 @@ File Name | Description
108
108
  [`sessiontagging2.js`](sessiontagging2.js) | More complex example of pooled connection tagging for setting session state
109
109
  [`soda1.js`](soda1.js) | Basic Simple Oracle Document Access (SODA) example
110
110
  [`typehandlerdate.js`](typehandlerdate.js) | Show how a type handler can format a queried date in a locale-specific way
111
- [`typehandlernum.js`](typehandlernum.js) | Show how a type handler can format a queried number in a locale-specific way
111
+ [`typehandlernum.js`](typehandlernum.js) | Show how a type handler can alter queried numbers
112
112
  [`version.js`](version.js) | Shows the node-oracledb version attributes
113
113
  [`webapp.js`](webapp.js) | A simple web application using a connection pool
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2019, 2022, Oracle and/or its affiliates.
1
+ // Copyright (c) 2019, 2023, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require('./constants.js');
30
31
  const errors = require('./errors.js');
31
32
 
package/lib/aqQueue.js CHANGED
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require('./constants.js');
30
31
  const errors = require('./errors.js');
31
32
  const nodbUtil = require('./util.js');
package/lib/connection.js CHANGED
@@ -28,6 +28,7 @@
28
28
 
29
29
  const AqQueue = require('./aqQueue.js');
30
30
  const BaseDbObject = require('./dbObject.js');
31
+ const { Buffer } = require('buffer');
31
32
  const Lob = require('./lob.js');
32
33
  const ResultSet = require('./resultset.js');
33
34
  const SodaDatabase = require('./sodaDatabase.js');
@@ -36,6 +37,7 @@ const QueryStream = require('./queryStream.js');
36
37
  const errors = require('./errors.js');
37
38
  const nodbUtil = require('./util.js');
38
39
  const impl = require('./impl');
40
+ const process = require('process');
39
41
  const util = require('util');
40
42
  const constants = require('./constants.js');
41
43
  const settings = require('./settings.js');
package/lib/errors.js CHANGED
@@ -136,6 +136,7 @@ const ERR_WRONG_VALUE_FOR_DBOBJECT_ATTR = 134;
136
136
  const ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM = 135;
137
137
  const ERR_WRONG_CRED_FOR_EXTAUTH = 136;
138
138
  const ERR_MISSING_BIND_VALUE = 137;
139
+ const ERR_SERVER_VERSION_NOT_SUPPORTED = 138;
139
140
 
140
141
  // Oracle Net layer errors start from 500
141
142
  const ERR_CONNECTION_CLOSED = 500;
@@ -314,7 +315,7 @@ messages.set(ERR_INVALID_NUMBER_OF_CONNECTIONS, // NJS-092
314
315
  messages.set(ERR_EXEC_MODE_ONLY_FOR_DML, // NJS-095
315
316
  'setting "batchErrors" or "dmlRowCounts" to true is only permitted for DML statements');
316
317
  messages.set(ERR_INVALID_BIND_NAME, // NJS-097
317
- 'no bind placeholder named ":%s" was found in the SQL text');
318
+ 'no bind placeholder named ":%s" was found in the statement text');
318
319
  messages.set(ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS, // NJS-098
319
320
  '%s positional bind values are required but %s were provided');
320
321
  messages.set(ERR_BUFFER_LENGTH_INSUFFICIENT, // NJS-099
@@ -393,6 +394,8 @@ messages.set(ERR_WRONG_CRED_FOR_EXTAUTH, // NJS-136
393
394
  'user name and password cannot be set when using external authentication');
394
395
  messages.set(ERR_MISSING_BIND_VALUE, // NJS-137
395
396
  'a bind variable replacement value for placeholder ":%s" was not provided');
397
+ messages.set(ERR_SERVER_VERSION_NOT_SUPPORTED, // NJS-138
398
+ 'connections to this database server version are not supported by node-oracledb in Thin mode');
396
399
 
397
400
  // Oracle Net layer errors
398
401
 
@@ -763,6 +766,7 @@ module.exports = {
763
766
  ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM,
764
767
  ERR_WRONG_CRED_FOR_EXTAUTH,
765
768
  ERR_MISSING_BIND_VALUE,
769
+ ERR_SERVER_VERSION_NOT_SUPPORTED,
766
770
  ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
767
771
  assert,
768
772
  assertArgCount,
package/lib/lob.js CHANGED
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const { Duplex } = require('stream');
30
31
  const constants = require('./constants.js');
31
32
  const errors = require('./errors.js');
package/lib/oracledb.js CHANGED
@@ -31,6 +31,7 @@ const nodbUtil = require('./util.js');
31
31
  const errors = require('./errors.js');
32
32
  const types = require('./types.js');
33
33
  const impl = require('./impl');
34
+ const process = require('process');
34
35
  const util = require('util');
35
36
 
36
37
  // This version of node-oracledb works with Node.js 14.6 or later.
@@ -68,7 +69,6 @@ const defaultPoolAlias = 'default';
68
69
  let _initOracleClientArgs;
69
70
  let _thinDriverInitialized = false;
70
71
 
71
-
72
72
  // Load the Oracledb binary
73
73
  function _initCLib() {
74
74
  /*global __non_webpack_require__*/ // quieten eslint
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const process = require('process');
29
30
  const settings = require('./settings.js');
30
31
 
31
32
  //-----------------------------------------------------------------------------
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2015, 2022, Oracle and/or its affiliates.
1
+ // Copyright (c) 2015, 2023, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const process = require('process');
29
30
  const { Readable } = require('stream');
30
31
 
31
32
  class QueryStream extends Readable {
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const SodaCollection = require('./sodaCollection.js');
30
31
  const SodaDocument = require('./sodaDocument.js');
31
32
  const errors = require('./errors.js');
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const ConnectionImpl = require('../impl/connection.js');
30
31
  const ThinResultSetImpl = require('./resultSet.js');
31
32
  const ThinLobImpl = require("./lob.js");
@@ -36,6 +37,7 @@ const { Statement } = require("./statement");
36
37
  const thinUtil = require('./util');
37
38
  const sqlNetConstants = require('./sqlnet/constants.js');
38
39
  const constants = require('./protocol/constants.js');
40
+ const process = require('process');
39
41
  const types = require('../types.js');
40
42
  const errors = require("../errors.js");
41
43
  const messages = require('./protocol/messages');
@@ -528,6 +530,13 @@ class ThinConnectionImpl extends ConnectionImpl {
528
530
  }
529
531
 
530
532
  this._protocol = new Protocol(this);
533
+
534
+ // check if the protocol version supported by the database is high
535
+ // enough; if not, reject the connection immediately
536
+ if (this._protocol.caps.protocolVersion < constants.TNS_VERSION_MIN_ACCEPTED) {
537
+ errors.throwErr(errors.ERR_SERVER_VERSION_NOT_SUPPORTED);
538
+ }
539
+
531
540
  try {
532
541
  let message = new messages.ProtocolMessage(this);
533
542
  await this._protocol._processMessage(message);
@@ -568,40 +577,34 @@ class ThinConnectionImpl extends ConnectionImpl {
568
577
  }
569
578
  if (statement.returnToCache) {
570
579
  statement.inUse = false;
571
- this._adjustStatementCache();
572
580
  } else if (statement.cursorId !== 0) {
573
- this._addCursorToClose(statement);
581
+ this._addCursorToClose(statement.cursorId);
574
582
  }
575
583
  }
576
584
 
577
585
  //---------------------------------------------------------------------------
578
586
  // Adds the cursors that needs to be closed to the _cursorsToClose set
579
587
  //---------------------------------------------------------------------------
580
- _addCursorToClose(stmt) {
581
- if (stmt.cursorId > 0 && this._cursorsToClose.has(stmt.cursorId)) {
582
- const reason = `attempt to close cursor ${stmt.cursorId} twice`;
588
+ _addCursorToClose(cursorId) {
589
+ if (this._cursorsToClose.has(cursorId)) {
590
+ const reason = `attempt to close cursor ${cursorId} twice`;
583
591
  errors.throwErr(errors.ERR_INTERNAL, reason);
584
592
  }
585
-
586
- if (this.statementCache.has(stmt.sql)) {
587
- this.statementCache.delete(stmt.sql);
588
- this._cursorsToClose.add(stmt.cursorId);
589
- } else if (stmt.cursorId > 0) {
590
- this._cursorsToClose.add(stmt.cursorId);
591
- }
593
+ this._cursorsToClose.add(cursorId);
592
594
  }
593
595
 
594
596
  //---------------------------------------------------------------------------
595
597
  // Adjusts the statement cache to remove least recently used statements
596
598
  //---------------------------------------------------------------------------
597
599
  _adjustStatementCache() {
598
- while (this.statementCache.size >= this.statementCacheSize) {
599
- let stmt = this.statementCache.get(this.statementCache.keys().next().value);
600
- this.statementCache.delete(this.statementCache.keys().next().value);
600
+ while (this.statementCache.size > this.statementCacheSize) {
601
+ const sql = this.statementCache.keys().next().value;
602
+ const stmt = this.statementCache.get(sql);
603
+ this.statementCache.delete(sql);
601
604
  if (stmt.inUse) {
602
605
  stmt.returnToCache = false;
603
606
  } else if (stmt.cursorId !== 0) {
604
- this._addCursorToClose(stmt);
607
+ this._addCursorToClose(stmt.cursorId);
605
608
  }
606
609
  }
607
610
  }
@@ -902,12 +905,14 @@ class ThinConnectionImpl extends ConnectionImpl {
902
905
  if (!statement) {
903
906
  statement = new Statement();
904
907
  statement._prepare(sql);
905
- if (cacheStatement && this.statementCache.size < this.statementCacheSize && !this._drcpEstablishSession && !statement.isDdl) {
906
- this.statementCache.set(sql, statement);
908
+ if (cacheStatement && !this._drcpEstablishSession && !statement.isDdl &&
909
+ this.statementCacheSize > 0) {
907
910
  statement.returnToCache = true;
911
+ this.statementCache.set(sql, statement);
908
912
  this._adjustStatementCache();
909
913
  }
910
- } else if (statement.inUse || !cacheStatement || this._drcpEstablishSession) {
914
+ } else if (statement.inUse || !cacheStatement ||
915
+ this._drcpEstablishSession) {
911
916
  if (!cacheStatement) {
912
917
  this.statementCache.delete(sql);
913
918
  statement.returnToCache = false;
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require('./protocol/constants.js');
30
31
  const errors = require('../errors.js');
31
32
  const types = require('../types.js');
package/lib/thin/lob.js CHANGED
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const LobImpl = require('../impl/lob.js');
30
31
  const constants = require('./protocol/constants.js');
31
32
  const LobOpMessage = require('./protocol/messages/lobOp.js');
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require("./constants.js");
30
31
  const errors = require("../../errors.js");
31
32
  const settings = require("../../settings.js");
@@ -686,7 +687,9 @@ class BaseBuffer {
686
687
  let numBytes = value.length;
687
688
  if (numBytes <= constants.TNS_MAX_SHORT_LENGTH) {
688
689
  this.writeUInt8(numBytes);
689
- this.writeBytes(value);
690
+ if (numBytes > 0) {
691
+ this.writeBytes(value);
692
+ }
690
693
  } else {
691
694
  let start = 0;
692
695
  this.writeUInt8(constants.TNS_LONG_LENGTH_INDICATOR);
@@ -984,7 +987,7 @@ class BaseBuffer {
984
987
  writeUInt64BE(n) {
985
988
  const buf = this.reserveBytes(8);
986
989
  buf.writeUInt32BE(0);
987
- buf.writeUInt32BE(n);
990
+ buf.writeUInt32BE(n, 4);
988
991
  }
989
992
 
990
993
  //---------------------------------------------------------------------------
@@ -26,7 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
- const Buffer = require("buffer").Buffer;
29
+ const { Buffer } = require('buffer');
30
30
  const constants = require("./constants.js");
31
31
  const errors = require('../../errors');
32
32
 
@@ -46,6 +46,7 @@ class Capabilities {
46
46
  this.runtimeCaps = Buffer.alloc(constants.TNS_RCAP_MAX);
47
47
  this.initCompileCaps();
48
48
  this.initRuntimeCaps();
49
+ this.maxStringSize = 0;
49
50
  }
50
51
 
51
52
  adjustForServerCompileCaps(serverCaps) {
@@ -56,8 +57,12 @@ class Capabilities {
56
57
  }
57
58
  }
58
59
 
59
- adjustForServerRuntimeCaps() {
60
- // nothing to do currently
60
+ adjustForServerRuntimeCaps(serverCaps) {
61
+ if (serverCaps[constants.TNS_RCAP_TTC] & constants.TNS_RCAP_TTC_32K) {
62
+ this.maxStringSize = 32767;
63
+ } else {
64
+ this.maxStringSize = 4000;
65
+ }
61
66
  }
62
67
 
63
68
  initCompileCaps() {
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require('../../constants.js');
30
31
 
31
32
  module.exports = {
@@ -557,6 +558,7 @@ module.exports = {
557
558
  // versions
558
559
  TNS_VERSION_DESIRED: 316,
559
560
  TNS_VERSION_MINIMUM: 300,
561
+ TNS_VERSION_MIN_ACCEPTED: 315,
560
562
  TNS_VERSION_MIN_LARGE_SDU: 315,
561
563
 
562
564
  // other connection constants
@@ -684,7 +686,6 @@ module.exports = {
684
686
  TNS_DURATION_MID: 0x80000000,
685
687
  TNS_DURATION_OFFSET: 60,
686
688
  TNS_DURATION_SESSION: 10,
687
- TNS_MIN_LONG_LENGTH: 0x8000,
688
689
  TNS_MAX_LONG_LENGTH: 0x7fffffff,
689
690
  TNS_SDU: 8192,
690
691
  TNS_TDU: 65535,
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2022, Oracle and/or its affiliates.
1
+ // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -26,7 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
- const Buffer = require('buffer').Buffer;
29
+ const { Buffer } = require('buffer');
30
30
  const crypto = require('crypto');
31
31
 
32
32
  let algorithm = 'aes-256-cbc';
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require("../constants.js");
30
31
  const errors = require("../../../errors.js");
31
32
  const os = require("os");
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require("../constants.js");
30
31
  const errors = require("../../../errors.js");
31
32
 
@@ -38,7 +38,16 @@ const Message = require("./base.js");
38
38
  */
39
39
  class DataTypeMessage extends Message {
40
40
 
41
- decode() { }
41
+ processMessage(buf) {
42
+ while (true) { // eslint-disable-line
43
+ const dataType = buf.readUInt16BE();
44
+ if (dataType === 0)
45
+ break;
46
+ const convDataType = buf.readUInt16BE();
47
+ if (convDataType !== 0)
48
+ buf.skipBytes(4);
49
+ }
50
+ }
42
51
 
43
52
  encode(buf) {
44
53
  buf.writeUInt8(constants.TNS_MSG_TYPE_DATA_TYPES);
@@ -275,7 +275,7 @@ class ExecuteMessage extends MessageWithData {
275
275
  // no rows have yet been sent so the header information needs to be sent
276
276
  if (this.currentRow === 0) {
277
277
  let stmt = this.statement;
278
- if (stmt.cursorId !== 0 && !stmt.requiresFullExecute && !stmt.requiresDefine && !stmt.isDdl) {
278
+ if (stmt.cursorId !== 0 && !stmt.requiresFullExecute && !this.parseOnly && !stmt.requiresDefine && !stmt.isDdl && !this.batchErrors) {
279
279
  if (stmt.isQuery && !stmt.requiresDefine && this.options.prefetchRows > 0) {
280
280
  this.functionCode = constants.TNS_FUNC_REEXECUTE_AND_FETCH;
281
281
  } else {
@@ -26,8 +26,9 @@
26
26
 
27
27
  'use strict';
28
28
 
29
- const Message = require('./base.js');
29
+ const { Buffer } = require('buffer');
30
30
  const constants = require('../constants.js');
31
+ const Message = require('./base.js');
31
32
 
32
33
  /**
33
34
  * Abstracts all LOB operations.
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const utils = require("../utils");
30
31
  const constants = require("../constants.js");
31
32
  const Message = require("./base.js");
@@ -95,7 +96,9 @@ class MessageWithData extends Message {
95
96
 
96
97
  processErrorInfo(buf) {
97
98
  super.processErrorInfo(buf);
98
- this.statement.cursorId = this.errorInfo.cursorId;
99
+ if (this.errorInfo.cursorId !== 0) {
100
+ this.statement.cursorId = this.errorInfo.cursorId;
101
+ }
99
102
  if (!this.statement.isPlSql) {
100
103
  this.statement.rowCount = this.errorInfo.rowCount;
101
104
  }
@@ -111,11 +114,8 @@ class MessageWithData extends Message {
111
114
  this.errorInfo.num = 0;
112
115
  this.errorOccurred = false;
113
116
  this.statement.moreRowsToFetch = false;
114
- } else if (this.errorInfo.num === constants.TNS_ERR_VAR_NOT_IN_SELECT_LIST) {
115
- this.connection._addCursorToClose(this.statement);
116
- this.connection.statementCache.delete(this.statement.sql);
117
117
  } else if (this.errorInfo.num !== 0 && this.errorInfo.cursorId !== 0) {
118
- this.connection._addCursorToClose(this.statement);
118
+ this.connection._addCursorToClose(this.statement.cursorId);
119
119
  this.connection.statementCache.delete(this.statement.sql);
120
120
  }
121
121
  if (this.errorInfo.batchErrors) {
@@ -450,10 +450,12 @@ class MessageWithData extends Message {
450
450
 
451
451
  if (!this.inFetch) {
452
452
  const actualNumBytes = buf.readSB4();
453
- if (actualNumBytes !== 0 && colValue !== null) {
453
+ if (actualNumBytes < 0 && oraTypeNum === constants.TNS_DATA_TYPE_BOOLEAN) {
454
+ colValue = null;
455
+ } else if (actualNumBytes !== 0 && colValue !== null) {
454
456
  errors.throwErr(errors.ERR_INSUFFICIENT_BUFFER_FOR_BINDS);
455
457
  }
456
- } else if (oraTypeNum === constants.TNS_DATA_TYPE_LONG || oraTypeNum === constants.TNS_DATA_TYPE_LONG_RAW || variable.maxSize >= constants.TNS_MIN_LONG_LENGTH) {
458
+ } else if (oraTypeNum === constants.TNS_DATA_TYPE_LONG || oraTypeNum === constants.TNS_DATA_TYPE_LONG_RAW || variable.maxSize > buf.caps.maxStringSize) {
457
459
  buf.skipSB4(); // null indicator
458
460
  buf.skipUB4(); // return code
459
461
  }
@@ -631,7 +633,7 @@ class MessageWithData extends Message {
631
633
  // expects that and complains if any other value is sent!
632
634
  buf.writeUInt8(0);
633
635
  buf.writeUInt8(0);
634
- if (maxSize >= constants.TNS_MIN_LONG_LENGTH) {
636
+ if (maxSize > buf.caps.maxStringSize) {
635
637
  buf.writeUB4(constants.TNS_MAX_LONG_LENGTH);
636
638
  } else {
637
639
  buf.writeUB4(maxSize);
@@ -679,7 +681,7 @@ class MessageWithData extends Message {
679
681
  this.writeBindParamsColumn(buf, variable, variable.values[i]);
680
682
  }
681
683
  } else {
682
- if (variable.maxSize >= constants.TNS_MIN_LONG_LENGTH) {
684
+ if (variable.maxSize > buf.caps.maxStringSize) {
683
685
  foundLong = true;
684
686
  } else {
685
687
  this.writeBindParamsColumn(buf, variable,
@@ -692,9 +694,8 @@ class MessageWithData extends Message {
692
694
  if (bindInfo.isReturnBind)
693
695
  continue;
694
696
  const variable = bindInfo.bindVar;
695
- if (variable.maxSize >= constants.TNS_MIN_LONG_LENGTH) {
696
- this.writeBindParamsColumn(buf, variable,
697
- variable.values[pos + offset]);
697
+ if (variable.maxSize > buf.caps.maxStringSize) {
698
+ this.writeBindParamsColumn(buf, variable, variable.values[pos + offset]);
698
699
  }
699
700
  }
700
701
  }
@@ -27,6 +27,7 @@
27
27
  'use strict';
28
28
 
29
29
  const { BaseBuffer, GrowableBuffer } = require('./buffer.js');
30
+ const { Buffer } = require('buffer');
30
31
  const constants = require("./constants.js");
31
32
  const errors = require("../../errors.js");
32
33
  const types = require("../../types.js");
@@ -27,9 +27,8 @@
27
27
  'use strict';
28
28
 
29
29
  const { BaseBuffer } = require('./buffer.js');
30
+ const { Buffer } = require('buffer');
30
31
  const constants = require("./constants.js");
31
-
32
- const buffer = require("buffer");
33
32
  const oson = require('./oson.js');
34
33
  const utils = require('./utils.js');
35
34
 
@@ -485,8 +484,8 @@ class WritePacket extends BaseBuffer {
485
484
  }
486
485
 
487
486
  writeKeyValue(key, value, flags = 0) {
488
- let keyBytesLen = buffer.Buffer.byteLength(key);
489
- let valBytesLen = buffer.Buffer.byteLength(value);
487
+ const keyBytesLen = Buffer.byteLength(key);
488
+ const valBytesLen = Buffer.byteLength(value);
490
489
  this.writeUB4(keyBytesLen);
491
490
  this.writeBytesWithLength(Buffer.from(key));
492
491
  this.writeUB4(valBytesLen);
@@ -26,6 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const constants = require('./constants');
30
31
  const crypto = require('crypto');
31
32
 
@@ -30,12 +30,13 @@ const Packet = require("./packet.js");
30
30
  const NTTCP = require("./ntTcp.js");
31
31
  const SessionAtts = require("./sessionAtts.js");
32
32
  const constants = require("./constants.js");
33
- const {createNode} = require('./connStrategy.js');
33
+ const { createNode } = require('./connStrategy.js');
34
34
  const errors = require("../../errors.js");
35
- const {findNVPairRecurse, createNVPair, findValue } = require("./nvStrToNvPair.js");
36
- const Buffer = require("buffer").Buffer;
35
+ const { findNVPairRecurse, createNVPair, findValue } = require("./nvStrToNvPair.js");
36
+ const { Buffer } = require('buffer');
37
37
  const EzConnect = require("./ezConnectResolver.js");
38
- const {NLParamParser, tnsnamesFilePath} = require("./paramParser.js");
38
+ const { NLParamParser, tnsnamesFilePath } = require("./paramParser.js");
39
+ const process = require('process');
39
40
 
40
41
  /**
41
42
  *
@@ -26,7 +26,9 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const net = require("net");
31
+ const process = require("process");
30
32
  const tls = require("tls");
31
33
  const http = require("http");
32
34
  const Timers = require('timers');
@@ -28,6 +28,7 @@
28
28
 
29
29
  const {createNVPair, findValue} = require("./nvStrToNvPair.js");
30
30
  const fs = require('fs');
31
+ const process = require('process');
31
32
  const readline = require('readline');
32
33
  const errors = require("../../errors.js");
33
34
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  'use strict';
28
28
 
29
- const buffer = require('buffer').Buffer;
29
+ const { Buffer } = require('buffer');
30
30
  const constants = require('../constants');
31
31
  const thinUtil = require("./util.js");
32
32
 
@@ -48,8 +48,8 @@ const BIND_PATTERN = /(?<=:)\s*((?:".*?")|(?:[\p{L}][\p{L}\p{Nd}_\$#]*)|\p{Nd}+)
48
48
  const DML_RETURNING_KEY = /(?<=\bRETURN(?:ING)?\b)/si;
49
49
  const DML_RETURNING_INTO_KEY = /(?<=\bINTO\b)/gsi;
50
50
 
51
- const SINGLE_LINE_COMMENT_PATTERN = /--.*/;
52
- const MULTI_LINE_COMMENT_PATTERN = /\/\*.*?\*\//s;
51
+ const SINGLE_LINE_COMMENT_PATTERN = /--.*/g;
52
+ const MULTI_LINE_COMMENT_PATTERN = /\/\*.*?\*\//sg;
53
53
  const CONSTANT_STRING_PATTERN = /'.*?'/sg;
54
54
 
55
55
  /**
@@ -110,8 +110,7 @@ class Statement {
110
110
  // Copying existing statement into new statement object required by drcp
111
111
  //---------------------------------------------------------------------------
112
112
  _copy() {
113
- let copiedStatement = new Statement();
114
- let bindInfoDict;
113
+ const copiedStatement = new Statement();
115
114
  copiedStatement.sql = this.sql;
116
115
  copiedStatement.sqlBytes = this.sqlBytes;
117
116
  copiedStatement.sqlLength = this.sqlLength;
@@ -121,16 +120,16 @@ class Statement {
121
120
  copiedStatement.isDdl = this.isDdl;
122
121
  copiedStatement.isReturning = this.isReturning;
123
122
  copiedStatement.bindInfoList = [];
124
- for (let bindInfo of this.bindInfoList) {
125
- copiedStatement.bindInfoList.push(bindInfo);
123
+ for (const bindInfo of this.bindInfoList) {
124
+ const newBindInfo = new BindInfo(bindInfo.bindName, bindInfo.isReturnBind);
125
+ copiedStatement.bindInfoList.push(newBindInfo);
126
126
  }
127
- copiedStatement.bindInfoDict = new Map();
128
- bindInfoDict = copiedStatement.bindInfoDict;
129
- for (let bindInfoObj of this.bindInfoList) {
130
- if (bindInfoDict.has(bindInfoObj.bindName)) {
131
- bindInfoDict.get(bindInfoObj.bindName).push(bindInfoObj);
127
+ const bindInfoDict = copiedStatement.bindInfoDict = new Map();
128
+ for (const bindInfo of copiedStatement.bindInfoList) {
129
+ if (bindInfoDict.has(bindInfo.bindName)) {
130
+ bindInfoDict.get(bindInfo.bindName).push(bindInfo);
132
131
  } else {
133
- bindInfoDict.set(bindInfoObj.bindName, [bindInfoObj]);
132
+ bindInfoDict.set(bindInfo.bindName, [bindInfo]);
134
133
  }
135
134
  }
136
135
  copiedStatement.returnToCache = false;
@@ -203,7 +202,7 @@ class Statement {
203
202
  //---------------------------------------------------------------------------
204
203
  _prepare(sql) {
205
204
  this.sql = sql;
206
- this.sqlBytes = buffer.from(this.sql, 'utf8');
205
+ this.sqlBytes = Buffer.from(this.sql, 'utf8');
207
206
  this.sqlLength = this.sqlBytes.length;
208
207
  // replace literals with a specific literal
209
208
  sql = sql.replace(CONSTANT_STRING_PATTERN, "'S'");
@@ -27,6 +27,7 @@
27
27
  'use strict';
28
28
 
29
29
  const BaseDbObject = require('./dbObject.js');
30
+ const { Buffer } = require('buffer');
30
31
  const Lob = require('./lob.js');
31
32
  const ResultSet = require('./resultset.js');
32
33
  const constants = require('./constants.js');
@@ -151,14 +152,15 @@ function transformValueIn(info, value, options) {
151
152
  types.DB_TYPE_CLOB,
152
153
  types.DB_TYPE_NCLOB);
153
154
  if (info.type !== types.DB_TYPE_CLOB &&
154
- info.type !== types.DB_TYPE_NCLOB &&
155
- info.cqn === undefined &&
156
- (info.maxSize === undefined || value.length > info.maxSize)) {
157
- if (info.checkSize) {
158
- errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
159
- value.length, options.pos);
155
+ info.type !== types.DB_TYPE_NCLOB) {
156
+ const valueLen = Buffer.byteLength(value);
157
+ if (info.maxSize === undefined || valueLen > info.maxSize) {
158
+ if (info.checkSize) {
159
+ errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
160
+ valueLen, options.pos);
161
+ }
162
+ info.maxSize = valueLen;
160
163
  }
161
- info.maxSize = value.length;
162
164
  }
163
165
  return value;
164
166
 
@@ -193,7 +195,7 @@ function transformValueIn(info, value, options) {
193
195
  checkType(info, options,
194
196
  types.DB_TYPE_RAW,
195
197
  types.DB_TYPE_BLOB);
196
- if (info.type === types.DB_TYPE_RAW && info.cqn === undefined &&
198
+ if (info.type === types.DB_TYPE_RAW &&
197
199
  (info.maxSize === undefined || value.length > info.maxSize)) {
198
200
  if (info.checkSize) {
199
201
  errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
package/lib/util.js CHANGED
@@ -26,7 +26,9 @@
26
26
 
27
27
  'use strict';
28
28
 
29
+ const { Buffer } = require('buffer');
29
30
  const errors = require('./errors.js');
31
+ const process = require('process');
30
32
  const util = require('util');
31
33
  const types = require('./types.js');
32
34
 
package/lib/version.js CHANGED
@@ -31,6 +31,6 @@
31
31
  module.exports = {
32
32
  VERSION_MAJOR: 6,
33
33
  VERSION_MINOR: 0,
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.0.0",
3
+ "version": "6.0.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.0.0-darwin-x64.node v16.20.0 860028aa05a0de50f81df433ab99d4f907f9a99a ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 16 May 2023 11:28:59 GMT
@@ -1 +0,0 @@
1
- 860028aa05a0de50f81df433ab99d4f907f9a99a
@@ -1 +0,0 @@
1
- oracledb-6.0.0-linux-arm64.node v16.20.0 860028aa05a0de50f81df433ab99d4f907f9a99a ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 16 May 2023 11:56:16 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.0-linux-x64.node v16.20.0 860028aa05a0de50f81df433ab99d4f907f9a99a ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 16 May 2023 13:29:42 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.0-win32-x64.node v16.19.0 860028aa05a0de50f81df433ab99d4f907f9a99a ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 16 May 2023 13:40:01 GMT