oracledb 6.5.1 → 6.7.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 (73) hide show
  1. package/README.md +2 -2
  2. package/build/Release/oracledb-6.7.0-darwin-arm64.node +0 -0
  3. package/build/Release/oracledb-6.7.0-darwin-arm64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.7.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-6.7.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.7.0-js-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.7.0-linux-arm64.node +0 -0
  8. package/build/Release/oracledb-6.7.0-linux-arm64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.7.0-linux-x64.node +0 -0
  10. package/build/Release/oracledb-6.7.0-linux-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.7.0-win32-x64.node +0 -0
  12. package/build/Release/oracledb-6.7.0-win32-x64.node-buildinfo.txt +1 -0
  13. package/examples/README.md +4 -0
  14. package/lib/configProviders/azure.js +178 -0
  15. package/lib/configProviders/base.js +85 -0
  16. package/lib/configProviders/ociobject.js +211 -0
  17. package/lib/connection.js +97 -14
  18. package/lib/constants.js +1 -0
  19. package/lib/errors.js +68 -6
  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/datahandlers/constants.js +3 -1
  24. package/lib/impl/datahandlers/vector.js +24 -9
  25. package/lib/impl/lob.js +29 -1
  26. package/lib/impl/pool.js +15 -0
  27. package/lib/impl/resultset.js +28 -2
  28. package/lib/impl/sodaCollection.js +2 -1
  29. package/lib/impl/sodaDatabase.js +2 -1
  30. package/lib/impl/sodaDocCursor.js +2 -1
  31. package/lib/impl/sodaOperation.js +2 -1
  32. package/lib/lob.js +55 -3
  33. package/lib/oracledb.js +246 -7
  34. package/lib/pool.js +14 -5
  35. package/lib/settings.js +1 -0
  36. package/lib/thin/connection.js +304 -29
  37. package/lib/thin/dbObject.js +4 -0
  38. package/lib/thin/lob.js +193 -1
  39. package/lib/thin/pool.js +18 -0
  40. package/lib/thin/protocol/capabilities.js +2 -0
  41. package/lib/thin/protocol/constants.js +29 -1
  42. package/lib/thin/protocol/messages/auth.js +12 -6
  43. package/lib/thin/protocol/messages/base.js +3 -0
  44. package/lib/thin/protocol/messages/index.js +5 -1
  45. package/lib/thin/protocol/messages/lobOp.js +17 -5
  46. package/lib/thin/protocol/messages/sessionRelease.js +1 -0
  47. package/lib/thin/protocol/messages/transactionChangeState.js +99 -0
  48. package/lib/thin/protocol/messages/transactionSwitch.js +139 -0
  49. package/lib/thin/protocol/messages/withData.js +21 -6
  50. package/lib/thin/protocol/protocol.js +23 -0
  51. package/lib/thin/sqlnet/connStrategy.js +9 -1
  52. package/lib/thin/sqlnet/constants.js +2 -0
  53. package/lib/thin/sqlnet/navNodes.js +14 -2
  54. package/lib/thin/sqlnet/networkSession.js +11 -10
  55. package/lib/thin/sqlnet/ntTcp.js +1 -1
  56. package/lib/thin/sqlnet/paramParser.js +87 -50
  57. package/lib/thin/sqlnet/sessionAtts.js +14 -2
  58. package/lib/thin/util.js +4 -3
  59. package/lib/traceHandler.js +133 -0
  60. package/lib/transformer.js +1 -2
  61. package/lib/types.js +1 -1
  62. package/lib/util.js +213 -35
  63. package/lib/version.js +2 -2
  64. package/package.json +1 -1
  65. package/build/Release/oracledb-6.5.1-darwin-x64.node +0 -0
  66. package/build/Release/oracledb-6.5.1-darwin-x64.node-buildinfo.txt +0 -1
  67. package/build/Release/oracledb-6.5.1-js-buildinfo.txt +0 -1
  68. package/build/Release/oracledb-6.5.1-linux-arm64.node +0 -0
  69. package/build/Release/oracledb-6.5.1-linux-arm64.node-buildinfo.txt +0 -1
  70. package/build/Release/oracledb-6.5.1-linux-x64.node +0 -0
  71. package/build/Release/oracledb-6.5.1-linux-x64.node-buildinfo.txt +0 -1
  72. package/build/Release/oracledb-6.5.1-win32-x64.node +0 -0
  73. package/build/Release/oracledb-6.5.1-win32-x64.node-buildinfo.txt +0 -1
@@ -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()
@@ -236,7 +237,8 @@ class ResultSetImpl {
236
237
  this.nestedCursorIndices.push(i);
237
238
  } else if (info.fetchType === types.DB_TYPE_CLOB ||
238
239
  info.fetchType === types.DB_TYPE_NCLOB ||
239
- info.fetchType === types.DB_TYPE_BLOB) {
240
+ info.fetchType === types.DB_TYPE_BLOB ||
241
+ info.fetchType === types.DB_TYPE_BFILE) {
240
242
  this.lobIndices.push(i);
241
243
  } else if (info.fetchType === types.DB_TYPE_OBJECT) {
242
244
  this.dbObjectIndices.push(i);
@@ -275,6 +277,30 @@ class ResultSetImpl {
275
277
  errors.throwNotImplemented("getting rows");
276
278
  }
277
279
 
280
+ //---------------------------------------------------------------------------
281
+ // _getAllRows() [INTERNAL]
282
+ //
283
+ // Fetches all the rows from the database to use internally.
284
+ //---------------------------------------------------------------------------
285
+ async _getAllRows() {
286
+ const fetchArraySize = 100;
287
+ // fetch all rows
288
+ let rowsFetched = [];
289
+ while (true) { // eslint-disable-line
290
+ // constant default value for fetchArraySize
291
+ const rows = await this.getRows(fetchArraySize, {});
292
+ if (rows) {
293
+ await this._processRows(rows, false);
294
+ rowsFetched = rowsFetched.concat(rows);
295
+ }
296
+ if (rows.length < fetchArraySize) {
297
+ break;
298
+ }
299
+ }
300
+
301
+ return rowsFetched;
302
+ }
303
+
278
304
  }
279
305
 
280
306
  module.exports = ResultSetImpl;
@@ -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
@@ -46,6 +46,22 @@ class Lob extends Duplex {
46
46
  });
47
47
  }
48
48
 
49
+ // called by BFILE specific functions to throw errors for other
50
+ // datatypes.
51
+ _checkIsBfile() {
52
+ if (this.type !== types.DB_TYPE_BFILE) {
53
+ errors.throwErr(errors.ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE);
54
+ }
55
+ }
56
+
57
+ // called by functions not allowed for BFILE and throw errors if
58
+ // such operations are performed on BFILE.
59
+ _checkNotBfile() {
60
+ if (this.type === types.DB_TYPE_BFILE) {
61
+ errors.throwErr(errors.ERR_OPERATION_NOT_SUPPORTED_ON_BFILE);
62
+ }
63
+ }
64
+
49
65
  // called by stream.destroy() and ensures that the LOB is closed if it has
50
66
  // not already been closed (never called directly)
51
67
  async _destroy(err, cb) {
@@ -101,7 +117,10 @@ class Lob extends Duplex {
101
117
  // called to associate a LOB implementation with this user facing object
102
118
  _setup(lobImpl, autoCloseLob) {
103
119
  this._impl = lobImpl;
104
- this._chunkSize = lobImpl.getChunkSize();
120
+ // chunk size is not defined for BFILE LOBs
121
+ if (this.type !== types.DB_TYPE_BFILE) {
122
+ this._chunkSize = lobImpl.getChunkSize();
123
+ }
105
124
  this._pieceSize = lobImpl.getPieceSize();
106
125
  this._length = lobImpl.getLength();
107
126
  this._type = lobImpl.getType();
@@ -153,6 +172,7 @@ class Lob extends Duplex {
153
172
  // Property for the chunk size of the LOB.
154
173
  //---------------------------------------------------------------------------
155
174
  get chunkSize() {
175
+ this._checkNotBfile();
156
176
  return this._chunkSize;
157
177
  }
158
178
 
@@ -209,6 +229,36 @@ class Lob extends Duplex {
209
229
  return await this._impl.getData(offset, amount);
210
230
  }
211
231
 
232
+ //---------------------------------------------------------------------------
233
+ // getDirFileName()
234
+ // To obtain the BFILE Lob object properties dirName & fileName
235
+ //---------------------------------------------------------------------------
236
+ getDirFileName() {
237
+ this._checkIsBfile();
238
+ return this._impl.getDirFileName();
239
+ }
240
+
241
+ //--------------------------------------------------------------------------
242
+ // setDirFileName()
243
+ // To set the BFILE Lob object properties dirName & fileName
244
+ //--------------------------------------------------------------------------
245
+ setDirFileName(a1) {
246
+ this._checkIsBfile();
247
+ errors.assertArgCount(arguments, 1, 1);
248
+ errors.assertParamValue(nodbUtil.isObject(a1), 1);
249
+ this._impl.setDirFileName(a1);
250
+ }
251
+
252
+ //---------------------------------------------------------------------------
253
+ // fileExists
254
+ //
255
+ // To obtain file existence status of BFILE file
256
+ //---------------------------------------------------------------------------
257
+ async fileExists() {
258
+ this._checkIsBfile();
259
+ return await this._impl.fileExists();
260
+ }
261
+
212
262
  //---------------------------------------------------------------------------
213
263
  // length
214
264
  //
@@ -248,8 +298,10 @@ class Lob extends Duplex {
248
298
 
249
299
  nodbUtil.wrapFns(Lob.prototype, errors.ERR_BUSY_LOB,
250
300
  "close",
301
+ "fileExists",
251
302
  "getData");
252
- Lob.prototype._serializedRead = nodbUtil.serialize(Lob.prototype._readData);
253
- 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);
254
306
 
255
307
  module.exports = Lob;
package/lib/oracledb.js CHANGED
@@ -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
@@ -129,6 +140,7 @@ async function _verifyOptions(options, inCreatePool) {
129
140
  // define normalized options (value returned to caller)
130
141
  const outOptions = {};
131
142
 
143
+ options = await _checkConfigProvider(options);
132
144
  // only one of "user" and "username" may be specified (and must be strings)
133
145
  if (options.user !== undefined) {
134
146
  errors.assertParamPropValue(typeof options.user === 'string', 1, "user");
@@ -177,6 +189,13 @@ async function _verifyOptions(options, inCreatePool) {
177
189
  outOptions.walletLocation = options.walletLocation;
178
190
  }
179
191
 
192
+ //wallet content must be a string
193
+ if (options.walletContent !== undefined) {
194
+ errors.assertParamPropValue(typeof options.walletContent === 'string', 1,
195
+ "walletContent");
196
+ outOptions.walletContent = options.walletContent;
197
+ }
198
+
180
199
  // edition must be a string
181
200
  if (options.edition !== undefined) {
182
201
  errors.assertParamPropValue(typeof options.edition === 'string', 1,
@@ -311,6 +330,38 @@ async function _verifyOptions(options, inCreatePool) {
311
330
  outOptions.privilege = options.privilege;
312
331
  }
313
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
+
314
365
  // check pool specific options
315
366
  if (inCreatePool) {
316
367
 
@@ -537,9 +588,12 @@ async function createPool(options) {
537
588
  // add defaults to options, if needed
538
589
  settings.addToOptions(options,
539
590
  "connectionClass",
591
+ "driverName",
540
592
  "edition",
541
593
  "events",
542
594
  "externalAuth",
595
+ "machine",
596
+ "osUser",
543
597
  "stmtCacheSize",
544
598
  "poolMax",
545
599
  "poolMaxPerShard",
@@ -548,6 +602,8 @@ async function createPool(options) {
548
602
  "poolTimeout",
549
603
  "poolPingInterval",
550
604
  "poolPingTimeout",
605
+ "program",
606
+ "terminal",
551
607
  "queueMax",
552
608
  "queueTimeout");
553
609
 
@@ -572,6 +628,8 @@ async function createPool(options) {
572
628
  // create the pool, ensuring that the temporary pool alias cache is removed
573
629
  // once this has completed (either successfully or unsuccessfully)
574
630
  const pool = new Pool();
631
+ pool._impl._connectString = options.connectString;
632
+ pool._impl._user = options.user;
575
633
  try {
576
634
  await pool._impl.create(options);
577
635
  } finally {
@@ -598,6 +656,22 @@ async function createPool(options) {
598
656
  return pool;
599
657
  }
600
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
+ }
601
675
 
602
676
  //-----------------------------------------------------------------------------
603
677
  // getConnection()
@@ -630,16 +704,23 @@ async function getConnection(a1) {
630
704
  options = await _verifyOptions(options, false);
631
705
  settings.addToOptions(options,
632
706
  "connectionClass",
707
+ "driverName",
633
708
  "edition",
634
709
  "events",
635
710
  "externalAuth",
636
- "stmtCacheSize");
711
+ "machine",
712
+ "osUser",
713
+ "program",
714
+ "stmtCacheSize",
715
+ "terminal");
637
716
  if (_initOracleClientArgs === undefined && !settings.thinDriverInitialized) {
638
717
  _initializeThinDriver();
639
718
  }
640
-
641
719
  const conn = new Connection();
642
720
  conn._impl = new impl.ConnectionImpl();
721
+
722
+ conn._impl._connectString = options.connectString;
723
+ conn._impl._user = options.user;
643
724
  await conn._impl.connect(options);
644
725
  if (_initOracleClientArgs === undefined) {
645
726
  settings.thinDriverInitialized = true;
@@ -760,7 +841,120 @@ async function shutdown(a1, a2) {
760
841
  await conn.close();
761
842
  }
762
843
 
844
+ //-----------------------------------------------------------------------------
845
+ // _checkConfigProvider()
846
+ //
847
+ // Look for the config provider in the connection string and retreives
848
+ // object stored in the config Provider.
849
+ // Returns object based on precedence between input object and the one retrieved
850
+ // from Config Provider.
851
+ //-----------------------------------------------------------------------------
852
+ async function _checkConfigProvider(options) {
853
+ // Time for Cache entries to be deleted in milliseconds
854
+ const cacheEntriesDuration = settings.configProviderCacheTimeout * 1000;
855
+ let secondOpts;
856
+ const url = options.connectString || options.connectionString;
857
+ if (!url)
858
+ return options;
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
879
+ }
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
+ }
911
+ }
912
+ }
913
+ if (secondOpts) {
914
+ options = modifyOptionsPrecedence(secondOpts, options);
915
+ }
916
+ return options;
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;
763
956
 
957
+ }
764
958
  //-----------------------------------------------------------------------------
765
959
  // startup()
766
960
  //
@@ -826,12 +1020,13 @@ module.exports = {
826
1020
  SodaOperation,
827
1021
 
828
1022
  // top-level functions
829
- getConnection: nodbUtil.callbackify(getConnection),
830
- 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)),
831
1026
  getPool,
832
1027
  initOracleClient,
833
- shutdown: nodbUtil.callbackify(shutdown),
834
- startup: nodbUtil.callbackify(startup),
1028
+ shutdown: nodbUtil.callbackify(nodbUtil.wrapFn(shutdown)),
1029
+ startup: nodbUtil.callbackify(nodbUtil.wrapFn(startup)),
835
1030
 
836
1031
  // CQN operation codes
837
1032
  CQN_OPCODE_ALL_OPS: constants.CQN_OPCODE_ALL_OPS,
@@ -1007,6 +1202,7 @@ module.exports = {
1007
1202
  VECTOR_FORMAT_FLOAT32: constants.VECTOR_FORMAT_FLOAT32,
1008
1203
  VECTOR_FORMAT_FLOAT64: constants.VECTOR_FORMAT_FLOAT64,
1009
1204
  VECTOR_FORMAT_INT8: constants.VECTOR_FORMAT_INT8,
1205
+ VECTOR_FORMAT_BINARY: constants.VECTOR_FORMAT_BINARY,
1010
1206
 
1011
1207
  // database type aliases
1012
1208
  BLOB: types.DB_TYPE_BLOB,
@@ -1022,6 +1218,9 @@ module.exports = {
1022
1218
  ARRAY: constants.OUT_FORMAT_ARRAY,
1023
1219
  OBJECT: constants.OUT_FORMAT_OBJECT,
1024
1220
 
1221
+ // Trace Interface
1222
+ traceHandler,
1223
+
1025
1224
  // Instances
1026
1225
  future,
1027
1226
 
@@ -1126,6 +1325,10 @@ module.exports = {
1126
1325
  return settings.stmtCacheSize;
1127
1326
  },
1128
1327
 
1328
+ get configProviderCacheTimeout() {
1329
+ return settings.configProviderCacheTimeout;
1330
+ },
1331
+
1129
1332
  get thin() {
1130
1333
  return settings.thin;
1131
1334
  },
@@ -1159,6 +1362,11 @@ module.exports = {
1159
1362
  settings.dbObjectAsPojo = value;
1160
1363
  },
1161
1364
 
1365
+ set driverName(value) {
1366
+ errors.assertPropValue(typeof value === 'string', "driverName");
1367
+ settings.driverName = value;
1368
+ },
1369
+
1162
1370
  set edition(value) {
1163
1371
  errors.assertPropValue(typeof value === 'string', "edition");
1164
1372
  settings.edition = value;
@@ -1211,11 +1419,25 @@ module.exports = {
1211
1419
  settings.lobPrefetchSize = value;
1212
1420
  },
1213
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
+
1214
1429
  set maxRows(value) {
1215
1430
  errors.assertPropValue(Number.isInteger(value) && value >= 0, "maxRows");
1216
1431
  settings.maxRows = value;
1217
1432
  },
1218
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
+
1219
1441
  set outFormat(value) {
1220
1442
  if (value !== constants.OUT_FORMAT_ARRAY &&
1221
1443
  value !== constants.OUT_FORMAT_OBJECT) {
@@ -1270,10 +1492,27 @@ module.exports = {
1270
1492
  settings.prefetchRows = value;
1271
1493
  },
1272
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
+
1273
1502
  set stmtCacheSize(value) {
1274
1503
  errors.assertPropValue(Number.isInteger(value) && value >= 0,
1275
1504
  "stmtCacheSize");
1276
1505
  settings.stmtCacheSize = value;
1277
1506
  },
1278
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
+
1279
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);