oracledb 6.6.0 → 6.7.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 (67) hide show
  1. package/README.md +2 -2
  2. package/build/Release/Linux_cmds.txt +972 -0
  3. package/build/Release/oracledb-6.7.1-darwin-arm64.node +0 -0
  4. package/build/Release/oracledb-6.7.1-darwin-arm64.node-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-6.7.1-darwin-x64.node +0 -0
  6. package/build/Release/oracledb-6.7.1-darwin-x64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.7.1-js-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-6.7.1-linux-arm64.node +0 -0
  9. package/build/Release/oracledb-6.7.1-linux-arm64.node-buildinfo.txt +1 -0
  10. package/build/Release/oracledb-6.7.1-linux-x64.node +0 -0
  11. package/build/Release/oracledb-6.7.1-linux-x64.node-buildinfo.txt +1 -0
  12. package/build/Release/oracledb-6.7.1-win32-x64.node +0 -0
  13. package/build/Release/oracledb-6.7.1-win32-x64.node-buildinfo.txt +1 -0
  14. package/examples/example.js +5 -5
  15. package/lib/configProviders/azure.js +26 -15
  16. package/lib/configProviders/base.js +23 -37
  17. package/lib/configProviders/ociobject.js +53 -45
  18. package/lib/connection.js +75 -3
  19. package/lib/errors.js +26 -14
  20. package/lib/impl/aqQueue.js +2 -1
  21. package/lib/impl/base.js +45 -0
  22. package/lib/impl/connection.js +53 -0
  23. package/lib/impl/lob.js +2 -1
  24. package/lib/impl/pool.js +15 -0
  25. package/lib/impl/resultset.js +2 -1
  26. package/lib/impl/sodaCollection.js +2 -1
  27. package/lib/impl/sodaDatabase.js +2 -1
  28. package/lib/impl/sodaDocCursor.js +2 -1
  29. package/lib/impl/sodaOperation.js +2 -1
  30. package/lib/lob.js +3 -2
  31. package/lib/oracledb.js +221 -36
  32. package/lib/pool.js +14 -5
  33. package/lib/settings.js +1 -0
  34. package/lib/thin/connection.js +150 -91
  35. package/lib/thin/dbObject.js +13 -4
  36. package/lib/thin/pool.js +3 -0
  37. package/lib/thin/protocol/constants.js +1 -1
  38. package/lib/thin/protocol/messages/auth.js +12 -6
  39. package/lib/thin/protocol/messages/base.js +3 -0
  40. package/lib/thin/protocol/messages/sessionRelease.js +1 -0
  41. package/lib/thin/protocol/messages/withData.js +6 -13
  42. package/lib/thin/protocol/protocol.js +23 -0
  43. package/lib/thin/sqlnet/connStrategy.js +12 -3
  44. package/lib/thin/sqlnet/constants.js +2 -0
  45. package/lib/thin/sqlnet/navNodes.js +30 -23
  46. package/lib/thin/sqlnet/networkSession.js +18 -14
  47. package/lib/thin/sqlnet/ntTcp.js +12 -6
  48. package/lib/thin/sqlnet/nvStrToNvPair.js +23 -26
  49. package/lib/thin/sqlnet/paramParser.js +42 -43
  50. package/lib/thin/sqlnet/sessionAtts.js +1 -1
  51. package/lib/thin/util.js +4 -3
  52. package/lib/traceHandler.js +133 -0
  53. package/lib/util.js +177 -33
  54. package/lib/version.js +2 -2
  55. package/package.json +1 -1
  56. package/build/Release/oracledb-6.6.0-darwin-arm64.node +0 -0
  57. package/build/Release/oracledb-6.6.0-darwin-arm64.node-buildinfo.txt +0 -1
  58. package/build/Release/oracledb-6.6.0-darwin-x64.node +0 -0
  59. package/build/Release/oracledb-6.6.0-darwin-x64.node-buildinfo.txt +0 -1
  60. package/build/Release/oracledb-6.6.0-js-buildinfo.txt +0 -1
  61. package/build/Release/oracledb-6.6.0-linux-arm64.node +0 -0
  62. package/build/Release/oracledb-6.6.0-linux-arm64.node-buildinfo.txt +0 -1
  63. package/build/Release/oracledb-6.6.0-linux-x64.node +0 -0
  64. package/build/Release/oracledb-6.6.0-linux-x64.node-buildinfo.txt +0 -1
  65. package/build/Release/oracledb-6.6.0-win32-x64.node +0 -0
  66. package/build/Release/oracledb-6.6.0-win32-x64.node-buildinfo.txt +0 -1
  67. package/examples/README.md +0 -138
@@ -0,0 +1,45 @@
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
+ class BaseImpl {
30
+
31
+ //---------------------------------------------------------------------------
32
+ // _getConnectTraceConfig()
33
+ //
34
+ // Retrieves connect trace config from connection object.
35
+ //---------------------------------------------------------------------------
36
+ _getConnectTraceConfig() {
37
+ const connImpl = this._getConnImpl();
38
+ if (connImpl) {
39
+ return connImpl._getConnectTraceConfig();
40
+ }
41
+ }
42
+
43
+ }
44
+
45
+ module.exports = BaseImpl;
@@ -69,6 +69,32 @@ class ConnectionImpl {
69
69
  return this;
70
70
  }
71
71
 
72
+ //---------------------------------------------------------------------------
73
+ // _getConnectTraceConfig()
74
+ //
75
+ // returns the necessary connection config used for debug/trace.
76
+ // ---------------------------------------------------------------------------
77
+ _getConnectTraceConfig() {
78
+ let traceConfig;
79
+
80
+ if (this._pool) {
81
+ traceConfig = this._pool._getConnectTraceConfig();
82
+ } else {
83
+ traceConfig = {connectString: this._connectString, user: this._user};
84
+ }
85
+ traceConfig.serviceName = this.getServiceName();
86
+ traceConfig.instanceName = this.getInstanceName();
87
+ traceConfig.pdbName = this.getDbName();
88
+
89
+ // Thick mode doesnt have these properties for now.
90
+ if (settings.thin) {
91
+ traceConfig.hostName = this.getHostName();
92
+ traceConfig.port = this.getPort();
93
+ traceConfig.protocol = this.getProtocol();
94
+ }
95
+ return traceConfig;
96
+ }
97
+
72
98
  //---------------------------------------------------------------------------
73
99
  // _getDbObjectType()
74
100
  //
@@ -589,6 +615,33 @@ class ConnectionImpl {
589
615
  errors.throwNotImplemented("unsubscribing from events");
590
616
  }
591
617
 
618
+ //---------------------------------------------------------------------------
619
+ // getHostName()
620
+ //
621
+ // Returns the Oracle Database host name associated with the connection.
622
+ //---------------------------------------------------------------------------
623
+ getHostName() {
624
+ errors.throwNotImplemented("getting HostName");
625
+ }
626
+
627
+ //---------------------------------------------------------------------------
628
+ // getPort()
629
+ //
630
+ // Returns the Oracle Database port number associated with the connection.
631
+ //---------------------------------------------------------------------------
632
+ getPort() {
633
+ errors.throwNotImplemented("getting Port");
634
+ }
635
+
636
+ //---------------------------------------------------------------------------
637
+ // getProtocol()
638
+ //
639
+ // Returns the protocol associated with the connection.
640
+ //---------------------------------------------------------------------------
641
+ getProtocol() {
642
+ errors.throwNotImplemented("getting Protocol");
643
+ }
644
+
592
645
  }
593
646
 
594
647
  // export just the class
package/lib/impl/lob.js CHANGED
@@ -28,8 +28,9 @@
28
28
 
29
29
  const ConnectionImpl = require('./connection.js');
30
30
  const errors = require('../errors.js');
31
+ const BaseImpl = require('./base.js');
31
32
 
32
- class LobImpl {
33
+ class LobImpl extends BaseImpl {
33
34
 
34
35
  //---------------------------------------------------------------------------
35
36
  // _getConnImpl()
package/lib/impl/pool.js CHANGED
@@ -174,6 +174,21 @@ class PoolImpl {
174
174
  errors.throwNotImplemented("getting the pool statement cache size");
175
175
  }
176
176
 
177
+ //---------------------------------------------------------------------------
178
+ // _getConnectTraceConfig()
179
+ //
180
+ // Returns the necessary connection config used by pool for debug/trace.
181
+ //---------------------------------------------------------------------------
182
+ _getConnectTraceConfig() {
183
+ return {
184
+ connectString: this._connectString,
185
+ user: this._user,
186
+ poolMin: this.getPoolMin(),
187
+ poolMax: this.getPoolMax(),
188
+ poolIncrement: this.getPoolIncrement()
189
+ };
190
+ }
191
+
177
192
  //---------------------------------------------------------------------------
178
193
  // getSodaMetaDataCache()
179
194
  //
@@ -34,9 +34,10 @@ const future = require('../future.js');
34
34
  const types = require('../types.js');
35
35
  const Lob = require('../lob.js');
36
36
  const oson = require('./datahandlers/oson.js');
37
+ const BaseImpl = require('./base.js');
37
38
 
38
39
  // define implementation class
39
- class ResultSetImpl {
40
+ class ResultSetImpl extends BaseImpl {
40
41
 
41
42
  //---------------------------------------------------------------------------
42
43
  // _determineFetchType()
@@ -27,8 +27,9 @@
27
27
  'use strict';
28
28
 
29
29
  const errors = require('../errors.js');
30
+ const BaseImpl = require('./base.js');
30
31
 
31
- class SodaCollectionImpl {
32
+ class SodaCollectionImpl extends BaseImpl {
32
33
 
33
34
  //---------------------------------------------------------------------------
34
35
  // _getConnImpl()
@@ -27,8 +27,9 @@
27
27
  'use strict';
28
28
 
29
29
  const errors = require('../errors.js');
30
+ const BaseImpl = require('./base.js');
30
31
 
31
- class SodaDatabaseImpl {
32
+ class SodaDatabaseImpl extends BaseImpl {
32
33
 
33
34
  //---------------------------------------------------------------------------
34
35
  // _getConnImpl()
@@ -27,8 +27,9 @@
27
27
  'use strict';
28
28
 
29
29
  const errors = require('../errors.js');
30
+ const BaseImpl = require('./base.js');
30
31
 
31
- class SodaDocCursorImpl {
32
+ class SodaDocCursorImpl extends BaseImpl {
32
33
 
33
34
  //---------------------------------------------------------------------------
34
35
  // _getConnImpl()
@@ -27,8 +27,9 @@
27
27
  'use strict';
28
28
 
29
29
  const errors = require('../errors.js');
30
+ const BaseImpl = require('./base.js');
30
31
 
31
- class SodaOperationImpl {
32
+ class SodaOperationImpl extends BaseImpl {
32
33
 
33
34
  //---------------------------------------------------------------------------
34
35
  // _getConnImpl()
package/lib/lob.js CHANGED
@@ -300,7 +300,8 @@ nodbUtil.wrapFns(Lob.prototype, errors.ERR_BUSY_LOB,
300
300
  "close",
301
301
  "fileExists",
302
302
  "getData");
303
- Lob.prototype._serializedRead = nodbUtil.serialize(Lob.prototype._readData);
304
- Lob.prototype._serializedWrite = nodbUtil.serialize(Lob.prototype._writeData);
303
+ Lob.prototype._serializedRead = nodbUtil.wrapFn(Lob.prototype._readData, true);
304
+ Lob.prototype._serializedWrite =
305
+ nodbUtil.wrapFn(Lob.prototype._writeData, true);
305
306
 
306
307
  module.exports = Lob;
package/lib/oracledb.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2015, 2023, Oracle and/or its affiliates.
1
+ // Copyright (c) 2015, 2024, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -47,8 +47,10 @@ errors.assert(vs[0] > 14 || (vs[0] === 14 && vs[1] >= 6),
47
47
  const AqDeqOptions = require('./aqDeqOptions.js');
48
48
  const AqEnqOptions = require('./aqEnqOptions.js');
49
49
  const AqMessage = require('./aqMessage.js');
50
+ const protocolUtil = require('./thin/protocol/utils.js');
50
51
  const AqQueue = require('./aqQueue.js');
51
52
  const future = require('./future.js');
53
+ const traceHandler = require('./traceHandler.js');
52
54
  const BaseDbObject = require('./dbObject.js');
53
55
  const Connection = require('./connection.js');
54
56
  const Lob = require('./lob.js');
@@ -65,14 +67,23 @@ const SodaOperation = require('./sodaOperation.js');
65
67
  const poolCache = {};
66
68
  const tempUsedPoolAliases = {};
67
69
  const defaultPoolAlias = 'default';
70
+ let configProviderCache;
68
71
 
69
72
  // save arguments for call to initOracleClient()
70
73
  let _initOracleClientArgs;
71
74
 
72
75
  // Load the Oracledb binary
73
76
  function _initCLib(options) {
77
+ // Ensure that webpack compile does not throw any issues or warnings
78
+ // See https://github.com/oracle/node-oracledb/issues/1156
79
+ // and https://github.com/oracle/node-oracledb/issues/1678
80
+ const nodeVer = typeof process !== 'undefined' && process.versions?.node;
74
81
  /*global __non_webpack_require__*/ // quieten eslint
75
- const requireBinary = (typeof __non_webpack_require__ === 'function') ? __non_webpack_require__ : require; // See Issue 1156
82
+ const requireBinary = nodeVer
83
+ ? (typeof __webpack_require__ === 'function')
84
+ ? __non_webpack_require__
85
+ : require
86
+ : undefined;
76
87
  const binaryLocations = [
77
88
  '../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE, // pre-built binary
78
89
  '../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BUILD_FILE, // binary built from source
@@ -319,6 +330,38 @@ async function _verifyOptions(options, inCreatePool) {
319
330
  outOptions.privilege = options.privilege;
320
331
  }
321
332
 
333
+ // machine must be a string
334
+ if (options.machine !== undefined) {
335
+ nodbUtil.assertParamPropNetworkName(options, 1, "machine");
336
+ outOptions.machine = options.machine;
337
+ }
338
+
339
+ // osUser must be a string
340
+ if (options.osUser !== undefined) {
341
+ nodbUtil.assertParamPropNetworkName(options, 1, "osUser");
342
+ outOptions.osUser = options.osUser;
343
+ }
344
+
345
+ // driverName must be a string
346
+ if (options.driverName !== undefined) {
347
+ errors.assertParamPropValue(typeof options.driverName === 'string',
348
+ 1, "driverName");
349
+ outOptions.driverName = options.driverName;
350
+ }
351
+
352
+ // program must be a string
353
+ if (options.program !== undefined) {
354
+ nodbUtil.assertParamPropNetworkName(options, 1, "program");
355
+ outOptions.program = options.program;
356
+ }
357
+
358
+ // terminal must be a string
359
+ if (options.terminal !== undefined) {
360
+ errors.assertParamPropValue(typeof options.terminal === 'string',
361
+ 1, "terminal");
362
+ outOptions.terminal = options.terminal;
363
+ }
364
+
322
365
  // check pool specific options
323
366
  if (inCreatePool) {
324
367
 
@@ -545,9 +588,12 @@ async function createPool(options) {
545
588
  // add defaults to options, if needed
546
589
  settings.addToOptions(options,
547
590
  "connectionClass",
591
+ "driverName",
548
592
  "edition",
549
593
  "events",
550
594
  "externalAuth",
595
+ "machine",
596
+ "osUser",
551
597
  "stmtCacheSize",
552
598
  "poolMax",
553
599
  "poolMaxPerShard",
@@ -556,6 +602,8 @@ async function createPool(options) {
556
602
  "poolTimeout",
557
603
  "poolPingInterval",
558
604
  "poolPingTimeout",
605
+ "program",
606
+ "terminal",
559
607
  "queueMax",
560
608
  "queueTimeout");
561
609
 
@@ -580,6 +628,8 @@ async function createPool(options) {
580
628
  // create the pool, ensuring that the temporary pool alias cache is removed
581
629
  // once this has completed (either successfully or unsuccessfully)
582
630
  const pool = new Pool();
631
+ pool._impl._connectString = options.connectString;
632
+ pool._impl._user = options.user;
583
633
  try {
584
634
  await pool._impl.create(options);
585
635
  } finally {
@@ -606,6 +656,22 @@ async function createPool(options) {
606
656
  return pool;
607
657
  }
608
658
 
659
+ //-----------------------------------------------------------------------------
660
+ // getNetworkServiceNames()
661
+ //
662
+ // Returns a list of the network service names found in the
663
+ // tnsnames.ora file which is inside the directory
664
+ // configDir or the $TNS_ADMIN dir
665
+ // If a tnsnames.ora file does not exist, then an exception is raised
666
+ //-----------------------------------------------------------------------------
667
+ async function getNetworkServiceNames(configDir) {
668
+ const { NLParamParser, tnsnamesFilePath } = require('./thin/sqlnet/paramParser.js');
669
+ const nlParamParser = new NLParamParser;
670
+ const filePath = tnsnamesFilePath(configDir);
671
+ const aliasht = await nlParamParser.initializeNlpa(filePath);
672
+ const keysArr = [ ...aliasht.keys() ];
673
+ return keysArr;
674
+ }
609
675
 
610
676
  //-----------------------------------------------------------------------------
611
677
  // getConnection()
@@ -638,16 +704,23 @@ async function getConnection(a1) {
638
704
  options = await _verifyOptions(options, false);
639
705
  settings.addToOptions(options,
640
706
  "connectionClass",
707
+ "driverName",
641
708
  "edition",
642
709
  "events",
643
710
  "externalAuth",
644
- "stmtCacheSize");
711
+ "machine",
712
+ "osUser",
713
+ "program",
714
+ "stmtCacheSize",
715
+ "terminal");
645
716
  if (_initOracleClientArgs === undefined && !settings.thinDriverInitialized) {
646
717
  _initializeThinDriver();
647
718
  }
648
-
649
719
  const conn = new Connection();
650
720
  conn._impl = new impl.ConnectionImpl();
721
+
722
+ conn._impl._connectString = options.connectString;
723
+ conn._impl._user = options.user;
651
724
  await conn._impl.connect(options);
652
725
  if (_initOracleClientArgs === undefined) {
653
726
  settings.thinDriverInitialized = true;
@@ -777,43 +850,111 @@ async function shutdown(a1, a2) {
777
850
  // from Config Provider.
778
851
  //-----------------------------------------------------------------------------
779
852
  async function _checkConfigProvider(options) {
853
+ // Time for Cache entries to be deleted in milliseconds
854
+ const cacheEntriesDuration = settings.configProviderCacheTimeout * 1000;
855
+ let secondOpts;
780
856
  const url = options.connectString || options.connectionString;
781
857
  if (!url)
782
858
  return options;
783
- let parsedUrl = url;
784
- let urlExtendedPart;
785
- const baseRegex = new RegExp("^config-(?<provider>[A-Za-z0-9]+)(://)(?<provider_arg>[^?]+)");
786
- if (url.indexOf('?') != -1) {
787
- parsedUrl = url.substring(0, url.indexOf('?'));
788
- urlExtendedPart = url.substring(url.indexOf('?'), url.length); //extended part
789
- }
790
- const match = parsedUrl.match(baseRegex);
791
- if (match) {
792
- const provider = match.groups.provider;
793
- const provider_arg = match.groups.provider_arg;
794
- let configPckg;
795
- try {
796
- configPckg = require('./configProviders/' + provider);
797
- } catch (err) {
798
- errors.throwErr(errors.ERR_CONFIG_PROVIDER_NOT_SUPPORTED, provider);
799
- }
800
- const configProvider = new configPckg(provider_arg, urlExtendedPart);
801
- try {
802
- configProvider.init();
803
- } catch (err) {
804
- errors.throwErr(errors.ERR_CONFIG_PROVIDER_LOAD_FAILED, err.message);
859
+
860
+ if (configProviderCache && configProviderCache.has(url) && ((Date.now() - configProviderCache.get(url).timeAdded) < cacheEntriesDuration)) {
861
+ const cacheOpts1 = configProviderCache.get(url).cacheOpts;
862
+ secondOpts = { ...cacheOpts1};
863
+
864
+ //deobfuscate password
865
+ if (secondOpts.password)
866
+ secondOpts.password = protocolUtil.getDeobfuscatedValue(secondOpts.password.value, secondOpts.password.obfuscatedValue);
867
+
868
+ //deobfuscate walletContent
869
+ if (secondOpts.walletContent)
870
+ secondOpts.walletContent = protocolUtil.getDeobfuscatedValue(secondOpts.walletContent.value, secondOpts.walletContent.obfuscatedValue);
871
+
872
+ } else {
873
+ let parsedUrl = url;
874
+ let urlExtendedPart;
875
+ const baseRegex = new RegExp("^config-(?<provider>[A-Za-z0-9]+)(://)(?<provider_arg>[^?]+)");
876
+ if (url.indexOf('?') != -1) {
877
+ parsedUrl = url.substring(0, url.indexOf('?'));
878
+ urlExtendedPart = url.substring(url.indexOf('?'), url.length); //extended part
805
879
  }
806
- let secondOpts;
807
- try {
808
- secondOpts = await configProvider.returnConfig();
809
- } catch (err) {
810
- errors.throwErr(errors.ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG, err.message);
880
+ const match = parsedUrl.match(baseRegex);
881
+ if (match) {
882
+ const provider = match.groups.provider;
883
+ const provider_arg = match.groups.provider_arg;
884
+ let configPckg;
885
+ try {
886
+ configPckg = require('./configProviders/' + provider);
887
+ } catch (err) {
888
+ errors.throwErr(errors.ERR_CONFIG_PROVIDER_NOT_SUPPORTED, provider);
889
+ }
890
+ const configProvider = new configPckg(provider_arg, urlExtendedPart);
891
+ try {
892
+ configProvider.init();
893
+ } catch (err) {
894
+ errors.throwErr(errors.ERR_CONFIG_PROVIDER_LOAD_FAILED, err.message);
895
+ }
896
+ try {
897
+ if (!configProviderCache) {
898
+ configProviderCache = new Map();
899
+ }
900
+ secondOpts = await configProvider.returnConfig();
901
+ // obfuscate password & walletcontent and store config in the cache
902
+ const cacheOpts = { ...secondOpts};
903
+ if (secondOpts.password)
904
+ cacheOpts.password = protocolUtil.setObfuscatedValue(secondOpts.password);
905
+ if (secondOpts.walletContent)
906
+ cacheOpts.walletContent = protocolUtil.setObfuscatedValue(secondOpts.walletContent);
907
+ configProviderCache.set(url, { cacheOpts, timeAdded: Date.now()});
908
+ } catch (err) {
909
+ errors.throwErr(errors.ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG, err.message);
910
+ }
811
911
  }
812
- options = configProvider.modifyOptionsPrecedence(secondOpts, options);
912
+ }
913
+ if (secondOpts) {
914
+ options = modifyOptionsPrecedence(secondOpts, options);
813
915
  }
814
916
  return options;
815
917
  }
918
+ /**
919
+ * Sets precedence for different parameters in cloudConfig/userConfig
920
+ * @param {cloudConfig} object - object retreived from cloud
921
+ * @param {userConfig} object - user input Object
922
+ */
923
+ function modifyOptionsPrecedence(cloudConfig, userConfig) {
924
+ // create a copy of userConfig object
925
+ userConfig = { ...userConfig };
926
+ if (!userConfig.user)
927
+ userConfig.user = cloudConfig.user;
928
+ if (!userConfig.password)
929
+ userConfig.password = cloudConfig.password;
930
+ if (cloudConfig.connectString) {
931
+ userConfig.connectString = cloudConfig.connectString;
932
+ userConfig.connectionString = undefined;
933
+ }
934
+ if (cloudConfig.walletContent)
935
+ userConfig.walletContent = cloudConfig.walletContent;
936
+ if (cloudConfig.poolMin)
937
+ userConfig.poolMin = cloudConfig.poolMin;
938
+ if (cloudConfig.poolMax)
939
+ userConfig.poolMax = cloudConfig.poolMax;
940
+ if (cloudConfig.poolIncrement)
941
+ userConfig.poolIncrement = cloudConfig.poolIncrement;
942
+ if (cloudConfig.poolTimeout)
943
+ userConfig.poolTimeout = cloudConfig.poolTimeout;
944
+ if (cloudConfig.poolPingInterval)
945
+ userConfig.poolPingInterval = cloudConfig.poolPingInterval;
946
+ if (cloudConfig.poolPingTimeout)
947
+ userConfig.poolPingTimeout = cloudConfig.poolPingTimeout;
948
+ if (cloudConfig.stmtCacheSize)
949
+ userConfig.stmtCacheSize = cloudConfig.stmtCacheSize;
950
+ if (cloudConfig.prefetchRows)
951
+ userConfig.prefetchRows = cloudConfig.prefetchRows;
952
+ if (cloudConfig.lobPrefetch)
953
+ userConfig.lobPrefetch = cloudConfig.lobPrefetch;
954
+
955
+ return userConfig;
816
956
 
957
+ }
817
958
  //-----------------------------------------------------------------------------
818
959
  // startup()
819
960
  //
@@ -879,12 +1020,13 @@ module.exports = {
879
1020
  SodaOperation,
880
1021
 
881
1022
  // top-level functions
882
- getConnection: nodbUtil.callbackify(getConnection),
883
- createPool: nodbUtil.callbackify(createPool),
1023
+ getConnection: nodbUtil.callbackify(nodbUtil.wrapFn(getConnection)),
1024
+ createPool: nodbUtil.callbackify(nodbUtil.wrapFn(createPool)),
1025
+ getNetworkServiceNames: nodbUtil.callbackify(nodbUtil.wrapFn(getNetworkServiceNames)),
884
1026
  getPool,
885
1027
  initOracleClient,
886
- shutdown: nodbUtil.callbackify(shutdown),
887
- startup: nodbUtil.callbackify(startup),
1028
+ shutdown: nodbUtil.callbackify(nodbUtil.wrapFn(shutdown)),
1029
+ startup: nodbUtil.callbackify(nodbUtil.wrapFn(startup)),
888
1030
 
889
1031
  // CQN operation codes
890
1032
  CQN_OPCODE_ALL_OPS: constants.CQN_OPCODE_ALL_OPS,
@@ -1076,6 +1218,9 @@ module.exports = {
1076
1218
  ARRAY: constants.OUT_FORMAT_ARRAY,
1077
1219
  OBJECT: constants.OUT_FORMAT_OBJECT,
1078
1220
 
1221
+ // Trace Interface
1222
+ traceHandler,
1223
+
1079
1224
  // Instances
1080
1225
  future,
1081
1226
 
@@ -1180,6 +1325,10 @@ module.exports = {
1180
1325
  return settings.stmtCacheSize;
1181
1326
  },
1182
1327
 
1328
+ get configProviderCacheTimeout() {
1329
+ return settings.configProviderCacheTimeout;
1330
+ },
1331
+
1183
1332
  get thin() {
1184
1333
  return settings.thin;
1185
1334
  },
@@ -1213,6 +1362,11 @@ module.exports = {
1213
1362
  settings.dbObjectAsPojo = value;
1214
1363
  },
1215
1364
 
1365
+ set driverName(value) {
1366
+ errors.assertPropValue(typeof value === 'string', "driverName");
1367
+ settings.driverName = value;
1368
+ },
1369
+
1216
1370
  set edition(value) {
1217
1371
  errors.assertPropValue(typeof value === 'string', "edition");
1218
1372
  settings.edition = value;
@@ -1265,11 +1419,25 @@ module.exports = {
1265
1419
  settings.lobPrefetchSize = value;
1266
1420
  },
1267
1421
 
1422
+ set machine(value) {
1423
+ errors.assertPropValue(typeof value === 'string', "machine");
1424
+ const sanitizedValue = nodbUtil.sanitize(value);
1425
+ errors.assertPropValue(value == sanitizedValue, "machine");
1426
+ settings.machine = value;
1427
+ },
1428
+
1268
1429
  set maxRows(value) {
1269
1430
  errors.assertPropValue(Number.isInteger(value) && value >= 0, "maxRows");
1270
1431
  settings.maxRows = value;
1271
1432
  },
1272
1433
 
1434
+ set osUser(value) {
1435
+ errors.assertPropValue(typeof value === 'string', "osUser");
1436
+ const sanitizedValue = nodbUtil.sanitize(value);
1437
+ errors.assertPropValue(value == sanitizedValue, "osUser");
1438
+ settings.osUser = value;
1439
+ },
1440
+
1273
1441
  set outFormat(value) {
1274
1442
  if (value !== constants.OUT_FORMAT_ARRAY &&
1275
1443
  value !== constants.OUT_FORMAT_OBJECT) {
@@ -1324,10 +1492,27 @@ module.exports = {
1324
1492
  settings.prefetchRows = value;
1325
1493
  },
1326
1494
 
1495
+ set program(value) {
1496
+ errors.assertPropValue(typeof value === 'string', "program");
1497
+ const sanitizedValue = nodbUtil.sanitize(value);
1498
+ errors.assertPropValue(value == sanitizedValue, "program");
1499
+ settings.program = value;
1500
+ },
1501
+
1327
1502
  set stmtCacheSize(value) {
1328
1503
  errors.assertPropValue(Number.isInteger(value) && value >= 0,
1329
1504
  "stmtCacheSize");
1330
1505
  settings.stmtCacheSize = value;
1331
1506
  },
1332
1507
 
1508
+ set terminal(value) {
1509
+ errors.assertPropValue(typeof value === 'string', "terminal");
1510
+ settings.terminal = value;
1511
+ },
1512
+ set configProviderCacheTimeout(value) {
1513
+ errors.assertPropValue(Number.isInteger(value) && value >= 0,
1514
+ "configProviderCacheTimeout");
1515
+ settings.configProviderCacheTimeout = value;
1516
+ }
1517
+
1333
1518
  };
package/lib/pool.js CHANGED
@@ -423,7 +423,7 @@ class Pool extends EventEmitter {
423
423
  throw err;
424
424
  }
425
425
 
426
- if (this._connectionsOut >= poolMax ||
426
+ while (this._connectionsOut >= poolMax ||
427
427
  this.status === constants.POOL_STATUS_RECONFIGURING) {
428
428
 
429
429
  // when the queue is huge, throw error early without waiting for queue
@@ -798,12 +798,21 @@ class Pool extends EventEmitter {
798
798
  return this._user;
799
799
  }
800
800
 
801
+ //---------------------------------------------------------------------------
802
+ // connectTraceConfig
803
+ //
804
+ // Property for getting the connection related config.
805
+ //---------------------------------------------------------------------------
806
+ get connectTraceConfig() {
807
+ return this._impl && this._impl._getConnectTraceConfig();
808
+ }
801
809
  }
802
810
 
803
- Pool.prototype.close = nodbUtil.callbackify(Pool.prototype.close);
804
- Pool.prototype.getConnection = nodbUtil.callbackify(Pool.prototype.getConnection);
805
- Pool.prototype.reconfigure = nodbUtil.callbackify(Pool.prototype.reconfigure);
806
- Pool.prototype.setAccessToken = nodbUtil.callbackify(Pool.prototype.setAccessToken);
811
+ nodbUtil.wrapFns(Pool.prototype, false,
812
+ "close",
813
+ "getConnection",
814
+ "reconfigure",
815
+ "setAccessToken");
807
816
 
808
817
  // DEPRECATED aliases
809
818
  Pool.prototype.terminate = Pool.prototype.close;
package/lib/settings.js CHANGED
@@ -59,6 +59,7 @@ class Settings {
59
59
  this.queueTimeout = 60000;
60
60
  this.queueMax = 500;
61
61
  this.stmtCacheSize = 30;
62
+ this.configProviderCacheTimeout = 86400;
62
63
  this.thin = true;
63
64
  this.thinDriverInitialized = false;
64
65
  this.createFetchTypeMap(this.fetchAsString, this.fetchAsBuffer);