oracledb 2.1.0 → 2.3.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 (52) hide show
  1. package/CHANGELOG.md +174 -54
  2. package/LICENSE.md +52 -18
  3. package/README.md +35 -68
  4. package/binding.gyp +5 -4
  5. package/lib/connection.js +164 -14
  6. package/lib/oracledb.js +160 -11
  7. package/lib/pool.js +33 -22
  8. package/lib/querystream.js +3 -2
  9. package/lib/rel.txt +1 -1
  10. package/odpi/LICENSE.md +1 -1
  11. package/odpi/README.md +25 -84
  12. package/odpi/embed/README.md +1 -1
  13. package/odpi/include/dpi.h +51 -7
  14. package/odpi/src/dpiConn.c +78 -9
  15. package/odpi/src/dpiContext.c +24 -10
  16. package/odpi/src/dpiEnv.c +5 -1
  17. package/odpi/src/dpiError.c +4 -0
  18. package/odpi/src/dpiErrorMessages.h +6 -4
  19. package/odpi/src/dpiImpl.h +125 -68
  20. package/odpi/src/dpiMsgProps.c +33 -0
  21. package/odpi/src/dpiObject.c +17 -10
  22. package/odpi/src/dpiObjectType.c +1 -1
  23. package/odpi/src/dpiOci.c +55 -40
  24. package/odpi/src/dpiOracleType.c +2 -2
  25. package/odpi/src/dpiPool.c +88 -18
  26. package/odpi/src/dpiStmt.c +57 -36
  27. package/odpi/src/dpiSubscr.c +117 -9
  28. package/odpi/src/dpiUtils.c +20 -9
  29. package/odpi/src/dpiVar.c +504 -430
  30. package/package/MAKEPKG.BAT +64 -1
  31. package/package/README.md +9 -5
  32. package/package/createpackage.js +2 -2
  33. package/package/extractpackage.js +2 -1
  34. package/package/oracledbinstall.js +19 -19
  35. package/package/package.json +4 -4
  36. package/package.json +4 -4
  37. package/src/njsCommon.cpp +94 -10
  38. package/src/njsCommon.h +73 -21
  39. package/src/njsConnection.cpp +1425 -458
  40. package/src/njsConnection.h +68 -19
  41. package/src/njsIntLob.cpp +5 -1
  42. package/src/njsIntLob.h +1 -1
  43. package/src/njsMessages.cpp +9 -2
  44. package/src/njsMessages.h +9 -2
  45. package/src/njsOracle.cpp +213 -23
  46. package/src/njsOracle.h +18 -2
  47. package/src/njsPool.cpp +32 -14
  48. package/src/njsPool.h +4 -4
  49. package/src/njsResultSet.cpp +4 -3
  50. package/src/njsResultSet.h +1 -1
  51. package/src/njsSubscription.cpp +388 -0
  52. package/src/njsSubscription.h +111 -0
package/lib/connection.js CHANGED
@@ -23,11 +23,17 @@ var resultset = require('./resultset.js');
23
23
  var QueryStream = require('./querystream.js');
24
24
  var nodbUtil = require('./util.js');
25
25
  var executePromisified;
26
+ var executeManyPromisified;
27
+ var getStatementInfoPromisified;
26
28
  var commitPromisified;
27
29
  var createLobPromisified;
28
30
  var rollbackPromisified;
29
- var releasePromisified;
31
+ var closePromisified;
30
32
  var breakPromisified;
33
+ var changePasswordPromisified;
34
+ var pingPromisified;
35
+ var subscribePromisified;
36
+ var unsubscribePromisified;
31
37
 
32
38
  // The queryStream function is similar to execute except that it immediately
33
39
  // returns a QueryStream.
@@ -181,6 +187,47 @@ function execute(sql, a2, a3, a4) {
181
187
 
182
188
  executePromisified = nodbUtil.promisify(execute);
183
189
 
190
+ // This executeMany function is used to override the executeMany method of
191
+ // the Connection class, which is defined in the C layer.
192
+ function executeMany(sql, binds, a3, a4) {
193
+ var self = this;
194
+ var options = {};
195
+ var executeCb;
196
+
197
+ nodbUtil.assert(arguments.length > 2 && arguments.length < 5, 'NJS-009');
198
+ nodbUtil.assert(typeof sql === 'string', 'NJS-006', 1);
199
+ nodbUtil.assert(Array.isArray(binds), 'NJS-006', 2);
200
+
201
+ switch (arguments.length) {
202
+ case 3:
203
+ nodbUtil.assert(typeof a3 === 'function', 'NJS-006', 3);
204
+ executeCb = a3;
205
+ break;
206
+ case 4:
207
+ nodbUtil.assert(nodbUtil.isObject(a3), 'NJS-006', 3);
208
+ nodbUtil.assert(typeof a4 === 'function', 'NJS-006', 4);
209
+ options = a3;
210
+ executeCb = a4;
211
+ break;
212
+ }
213
+
214
+ self._executeMany.call(self, sql, binds, options, executeCb);
215
+ }
216
+
217
+ executeManyPromisified = nodbUtil.promisify(executeMany);
218
+
219
+ // This getStatementInfo function is just a place holder to allow for easier extension later.
220
+ function getStatementInfo(sql, getStatementInfoCb) {
221
+ var self = this;
222
+
223
+ nodbUtil.assert(arguments.length === 2, 'NJS-009');
224
+ nodbUtil.assert(typeof getStatementInfoCb === 'function', 'NJS-006', 1);
225
+
226
+ self._getStatementInfo.apply(self, arguments);
227
+ }
228
+
229
+ getStatementInfoPromisified = nodbUtil.promisify(getStatementInfo);
230
+
184
231
  // This commit function is just a place holder to allow for easier extension later.
185
232
  function commit(commitCb) {
186
233
  var self = this;
@@ -217,26 +264,26 @@ function rollback(rollbackCb) {
217
264
 
218
265
  rollbackPromisified = nodbUtil.promisify(rollback);
219
266
 
220
- // This release function is used to override the release method of the Connection
267
+ // This close function is used to override the close method of the Connection
221
268
  // class, which is defined in the C layer.
222
- function release(releaseCb) {
269
+ function close(closeCb) {
223
270
  var self = this;
224
271
 
225
272
  nodbUtil.assert(arguments.length === 1, 'NJS-009');
226
- nodbUtil.assert(typeof releaseCb === 'function', 'NJS-006', 1);
273
+ nodbUtil.assert(typeof closeCb === 'function', 'NJS-006', 1);
227
274
 
228
- self._release(function(err) {
275
+ self._close(function(err) {
229
276
  if (!err) {
230
277
  self.emit('_after_close');
231
278
  }
232
279
 
233
- releaseCb(err);
280
+ closeCb(err);
234
281
  });
235
282
  }
236
283
 
237
- releasePromisified = nodbUtil.promisify(release);
284
+ closePromisified = nodbUtil.promisify(close);
238
285
 
239
- // This release function is just a place holder to allow for easier extension later.
286
+ // This break function is just a place holder to allow for easier extension later.
240
287
  // It's attached to the module as break is a reserved word.
241
288
  module.break = function(breakCb) {
242
289
  var self = this;
@@ -249,6 +296,61 @@ module.break = function(breakCb) {
249
296
 
250
297
  breakPromisified = nodbUtil.promisify(module.break);
251
298
 
299
+ // This changePassword function is just a place holder to allow for easier extension later.
300
+ function changePassword(user, password, newPassword, changePasswordCb) {
301
+ var self = this;
302
+
303
+ nodbUtil.assert(arguments.length === 4, 'NJS-009');
304
+ nodbUtil.assert(typeof user === 'string', 'NJS-006', 1);
305
+ nodbUtil.assert(typeof password === 'string', 'NJS-006', 2);
306
+ nodbUtil.assert(typeof newPassword === 'string', 'NJS-006', 3);
307
+ nodbUtil.assert(typeof changePasswordCb === 'function', 'NJS-006', 4);
308
+
309
+ self._changePassword.apply(self, arguments);
310
+ }
311
+
312
+ changePasswordPromisified = nodbUtil.promisify(changePassword);
313
+
314
+ // This ping function is just a place holder to allow for easier extension later.
315
+ function ping(pingCb) {
316
+ var self = this;
317
+
318
+ nodbUtil.assert(arguments.length === 1, 'NJS-009');
319
+ nodbUtil.assert(typeof pingCb === 'function', 'NJS-006', 1);
320
+
321
+ self._ping.apply(self, arguments);
322
+ }
323
+
324
+ pingPromisified = nodbUtil.promisify(ping);
325
+
326
+ // create a subscription which can be used to get notifications of database
327
+ // changes
328
+ function subscribe(name, options, subscribeCb) {
329
+ var self = this;
330
+
331
+ nodbUtil.assert(arguments.length == 3, 'NJS-009');
332
+ nodbUtil.assert(typeof name === 'string', 'NJS-006', 1);
333
+ nodbUtil.assert(nodbUtil.isObject(options), 'NJS-006', 2);
334
+ nodbUtil.assert(typeof subscribeCb === 'function', 'NJS-006', 3);
335
+ self._subscribe.call(self, name, options, subscribeCb);
336
+ }
337
+
338
+ subscribePromisified = nodbUtil.promisify(subscribe);
339
+
340
+ // destroy a subscription which was earlier created using subscribe()
341
+ function unsubscribe(name, cb) {
342
+ var self = this;
343
+
344
+ nodbUtil.assert(arguments.length == 2, 'NJS-009');
345
+ nodbUtil.assert(typeof name === 'string', 'NJS-006', 1);
346
+ nodbUtil.assert(typeof cb === 'function', 'NJS-006', 2);
347
+
348
+ self._unsubscribe.call(self, name, cb);
349
+ }
350
+
351
+ unsubscribePromisified = nodbUtil.promisify(unsubscribe);
352
+
353
+
252
354
  // The extend method is used to extend the Connection instance from the C layer with
253
355
  // custom properties and method overrides. References to the original methods are
254
356
  // maintained so they can be invoked by the overriding method at the right time.
@@ -269,6 +371,14 @@ function extend(conn, oracledb, pool) {
269
371
  _execute: {
270
372
  value: conn.execute
271
373
  },
374
+ _getStatementInfo: {
375
+ value: conn.getStatementInfo
376
+ },
377
+ getStatementInfo: {
378
+ value: getStatementInfoPromisified,
379
+ enumerable: true,
380
+ writable: true
381
+ },
272
382
  queryStream: {
273
383
  value: queryStream,
274
384
  enumerable: true,
@@ -279,6 +389,14 @@ function extend(conn, oracledb, pool) {
279
389
  enumerable: true,
280
390
  writable: true
281
391
  },
392
+ _executeMany: {
393
+ value: conn.executeMany
394
+ },
395
+ executeMany: {
396
+ value: executeManyPromisified,
397
+ enumerable: true,
398
+ writable: true
399
+ },
282
400
  _commit: {
283
401
  value: conn.commit
284
402
  },
@@ -303,16 +421,16 @@ function extend(conn, oracledb, pool) {
303
421
  enumerable: true,
304
422
  writable: true
305
423
  },
306
- _release: {
307
- value: conn.release
424
+ _close: {
425
+ value: conn.close
308
426
  },
309
- release: {
310
- value: releasePromisified,
427
+ close: {
428
+ value: closePromisified,
311
429
  enumerable: true,
312
430
  writable: true
313
431
  },
314
- close: { // alias for release
315
- value: releasePromisified,
432
+ release: { // alias for close
433
+ value: closePromisified,
316
434
  enumerable: true,
317
435
  writable: true
318
436
  },
@@ -323,6 +441,38 @@ function extend(conn, oracledb, pool) {
323
441
  value: breakPromisified,
324
442
  enumerable: true,
325
443
  writable: true
444
+ },
445
+ _changePassword: {
446
+ value: conn.changePassword
447
+ },
448
+ changePassword: {
449
+ value: changePasswordPromisified,
450
+ enumerable: true,
451
+ writable: true
452
+ },
453
+ _ping: {
454
+ value: conn.ping
455
+ },
456
+ ping: {
457
+ value: pingPromisified,
458
+ enumerable: true,
459
+ writable: true
460
+ },
461
+ _subscribe: {
462
+ value: conn.subscribe
463
+ },
464
+ subscribe: {
465
+ value: subscribePromisified,
466
+ enumerable: true,
467
+ writable: true
468
+ },
469
+ _unsubscribe: {
470
+ value: conn.unsubscribe
471
+ },
472
+ unsubscribe: {
473
+ value: unsubscribePromisified,
474
+ enumerable: true,
475
+ writable: true
326
476
  }
327
477
  }
328
478
  );
package/lib/oracledb.js CHANGED
@@ -79,24 +79,31 @@ oracledbCLib.Oracledb.prototype.newLob = function(iLob) {
79
79
  function getInfo() {
80
80
  var arch, url, mesg = '';
81
81
  mesg = 'Node-oracledb installation instructions: ';
82
- mesg += 'https://github.com/oracle/node-oracledb/blob/master/INSTALL.md\n';
82
+ mesg += 'https://oracle.github.io/node-oracledb/INSTALL.html\n';
83
83
  if (process.platform === 'linux') {
84
84
  if (process.arch === 'x64') {
85
85
  url = 'http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html\n';
86
86
  arch = '64-bit';
87
- } else {
87
+ } else if (process.arch === 'x32') {
88
88
  url = 'http://www.oracle.com/technetwork/topics/linuxsoft-082809.html\n';
89
89
  arch = '32-bit';
90
+ } else {
91
+ url = 'http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html\n';
92
+ arch = process.arch;
90
93
  }
91
94
  mesg += 'You must have ' + arch + ' Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.\n';
92
95
  mesg += 'If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from \n';
93
96
  mesg += url;
94
97
  } else if (process.platform === 'darwin') {
95
- url = 'http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html';
96
98
  if (process.arch === 'x64') {
99
+ url = 'http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html';
97
100
  arch = '64-bit';
98
- } else {
101
+ } else if (process.arch === 'x32') {
102
+ url = 'http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html';
99
103
  arch = '32-bit';
104
+ } else {
105
+ url = 'http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html\n';
106
+ arch = process.arch;
100
107
  }
101
108
  mesg += 'You must have the ' + arch + ' Oracle Instant Client Basic or Basic Light package in ~/lib or /usr/local/lib\n';
102
109
  mesg += 'They can be downloaded from ' + url;
@@ -104,9 +111,12 @@ function getInfo() {
104
111
  if (process.arch === 'x64') {
105
112
  url = 'http://www.oracle.com/technetwork/topics/winx64soft-089540.html\n';
106
113
  arch = '64-bit';
107
- } else {
114
+ } else if (process.arch === 'x32') {
108
115
  url = 'http://www.oracle.com/technetwork/topics/winsoft-085727.html\n';
109
116
  arch = '32-bit';
117
+ } else {
118
+ url = 'http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html\n';
119
+ arch = process.arch;
110
120
  }
111
121
  mesg += 'You must have ' + arch + ' Oracle client libraries in your PATH environment variable.\n';
112
122
  mesg += 'If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from\n';
@@ -114,12 +124,7 @@ function getInfo() {
114
124
  mesg += 'A Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available.\n';
115
125
  } else {
116
126
  url = 'http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html\n';
117
- if (process.arch === 'x64') {
118
- arch = '64-bit';
119
- } else {
120
- arch = '32-bit';
121
- }
122
- mesg += 'You must have ' + arch + ' Oracle client libraries in your operating system library search path.\n';
127
+ mesg += 'You must have ' + process.arch + ' Oracle client libraries in your operating system library search path.\n';
123
128
  mesg += 'If you do not have Oracle Database on this computer, then install an Instant Client Basic or Basic Light package from: \n';
124
129
  mesg += url;
125
130
  }
@@ -319,6 +324,34 @@ function extend(oracledb) {
319
324
  value: 0,
320
325
  enumerable: true
321
326
  },
327
+ CQN_OPCODE_ALL_OPS: {
328
+ value: 0,
329
+ enumerable: true
330
+ },
331
+ CQN_OPCODE_ALL_ROWS: {
332
+ value: 1,
333
+ enumerable: true
334
+ },
335
+ CQN_OPCODE_ALTER: {
336
+ value: 16,
337
+ enumerable: true
338
+ },
339
+ CQN_OPCODE_DELETE: {
340
+ value: 8,
341
+ enumerable: true
342
+ },
343
+ CQN_OPCODE_DROP: {
344
+ value: 32,
345
+ enumerable: true
346
+ },
347
+ CQN_OPCODE_INSERT: {
348
+ value: 2,
349
+ enumerable: true
350
+ },
351
+ CQN_OPCODE_UPDATE: {
352
+ value: 4,
353
+ enumerable: true
354
+ },
322
355
  DB_TYPE_VARCHAR: {
323
356
  value: 1,
324
357
  enumerable: true
@@ -391,10 +424,126 @@ function extend(oracledb) {
391
424
  value : 1112,
392
425
  enumerable : true
393
426
  },
427
+ STMT_TYPE_UNKNOWN: {
428
+ value : 0,
429
+ enumerable : true
430
+ },
431
+ STMT_TYPE_SELECT: {
432
+ value : 1,
433
+ enumerable : true
434
+ },
435
+ STMT_TYPE_UPDATE: {
436
+ value : 2,
437
+ enumerable : true
438
+ },
439
+ STMT_TYPE_DELETE: {
440
+ value : 3,
441
+ enumerable : true
442
+ },
443
+ STMT_TYPE_INSERT: {
444
+ value : 4,
445
+ enumerable : true
446
+ },
447
+ STMT_TYPE_CREATE: {
448
+ value : 5,
449
+ enumerable : true
450
+ },
451
+ STMT_TYPE_DROP: {
452
+ value : 6,
453
+ enumerable : true
454
+ },
455
+ STMT_TYPE_ALTER: {
456
+ value : 7,
457
+ enumerable : true
458
+ },
459
+ STMT_TYPE_BEGIN: {
460
+ value : 8,
461
+ enumerable : true
462
+ },
463
+ STMT_TYPE_DECLARE: {
464
+ value : 9,
465
+ enumerable : true
466
+ },
467
+ STMT_TYPE_CALL: {
468
+ value : 10,
469
+ enumerable : true
470
+ },
471
+ STMT_TYPE_EXPLAIN_PLAN: {
472
+ value : 15,
473
+ enumerable : true
474
+ },
475
+ STMT_TYPE_MERGE: {
476
+ value : 16,
477
+ enumerable : true
478
+ },
479
+ STMT_TYPE_ROLLBACK: {
480
+ value : 17,
481
+ enumerable : true
482
+ },
483
+ STMT_TYPE_COMMIT: {
484
+ value : 21,
485
+ enumerable : true
486
+ },
394
487
  STRING: {
395
488
  value: 2001,
396
489
  enumerable: true
397
490
  },
491
+ SUBSCR_EVENT_TYPE_DEREG: {
492
+ value: 5,
493
+ enumerable: true
494
+ },
495
+ SUBSCR_EVENT_TYPE_OBJ_CHANGE: {
496
+ value: 6,
497
+ enumerable: true
498
+ },
499
+ SUBSCR_EVENT_TYPE_QUERY_CHANGE: {
500
+ value: 7,
501
+ enumerable: true
502
+ },
503
+ SUBSCR_EVENT_TYPE_AQ: {
504
+ value: 100,
505
+ enumerable: true
506
+ },
507
+ SUBSCR_GROUPING_CLASS_TIME: {
508
+ value: 1,
509
+ enumerable: true
510
+ },
511
+ SUBSCR_GROUPING_TYPE_SUMMARY: {
512
+ value: 1,
513
+ enumerable: true
514
+ },
515
+ SUBSCR_GROUPING_TYPE_LAST: {
516
+ value: 2,
517
+ enumerable: true
518
+ },
519
+ SUBSCR_NAMESPACE_AQ: {
520
+ value: 1,
521
+ enumerable: true
522
+ },
523
+ SUBSCR_NAMESPACE_DBCHANGE: {
524
+ value: 2,
525
+ enumerable: true
526
+ },
527
+ SUBSCR_QOS_BEST_EFFORT: {
528
+ value: 16,
529
+ enumerable: true
530
+ },
531
+ SUBSCR_QOS_DEREG_NFY: {
532
+ value: 2,
533
+ enumerable: true
534
+ },
535
+ SUBSCR_QOS_QUERY: {
536
+ value: 8,
537
+ enumerable: true
538
+ },
539
+ SUBSCR_QOS_RELIABLE: {
540
+ value: 1,
541
+ enumerable: true
542
+ },
543
+ SUBSCR_QOS_ROWIDS: {
544
+ value: 4,
545
+ enumerable: true
546
+ },
398
547
  NUMBER: {
399
548
  value: 2002,
400
549
  enumerable: true
package/lib/pool.js CHANGED
@@ -22,19 +22,19 @@
22
22
  var connection = require('./connection.js');
23
23
  var nodbUtil = require('./util.js');
24
24
  var getConnectionPromisified;
25
- var terminatePromisified;
25
+ var closePromisified;
26
26
 
27
27
  // completeConnectionRequest does the actual work of getting a connection from a
28
28
  // pool when queuing is enabled. It's abstracted out so it can be called from
29
29
  // getConnection and checkRequestQueue constently.
30
- function completeConnectionRequest(getConnectionCb) {
30
+ function completeConnectionRequest(config, getConnectionCb) {
31
31
  var self = this;
32
32
 
33
33
  // Incrementing _connectionsOut prior to making the async call to get a connection
34
34
  // to prevent other connection requests from exceeding the poolMax.
35
35
  self._connectionsOut += 1;
36
36
 
37
- self._getConnection(function(err, connInst) {
37
+ self._getConnection(config, function(err, connInst) {
38
38
  if (err) {
39
39
  // Decrementing _connectionsOut if we didn't actually get a connection
40
40
  // and then rechecking the queue.
@@ -98,7 +98,8 @@ function checkRequestQueue() {
98
98
  payload.timerIdx = null;
99
99
  }
100
100
 
101
- completeConnectionRequest.call(self, payload.getConnectionCb);
101
+ completeConnectionRequest.call(self, payload.config,
102
+ payload.getConnectionCb);
102
103
  }
103
104
 
104
105
  // onRequestTimeout is used to prevent requests for connections from sitting in the
@@ -129,14 +130,23 @@ function onRequestTimeout(timerIdx) {
129
130
  // directly to the C layer if queueing is disabled. If queueing is enabled and the
130
131
  // connections out is under the poolMax then the request will be completed immediately.
131
132
  // Otherwise the request will be queued and completed when a connection is avaialble.
132
- function getConnection(getConnectionCb) {
133
+ function getConnection(a1, a2) {
133
134
  var self = this;
134
135
  var payload;
135
136
  var timeoutHandle;
136
137
  var timerIdx;
138
+ var getConnectionCb = arguments[arguments.length - 1];
139
+ var options = {};
137
140
 
138
- nodbUtil.assert(arguments.length === 1, 'NJS-009');
139
- nodbUtil.assert(typeof getConnectionCb === 'function', 'NJS-006', 1);
141
+ nodbUtil.assert(arguments.length >= 1 && arguments.length <= 2, 'NJS-009');
142
+ nodbUtil.assert(typeof getConnectionCb === 'function', 'NJS-006',
143
+ arguments.length);
144
+
145
+ // Optional JSON parameter
146
+ if (arguments.length > 1 ) {
147
+ options = arguments[0];
148
+ nodbUtil.assert(nodbUtil.isObject(options), 'NJS-006', 1 );
149
+ }
140
150
 
141
151
  // Added this check because if the pool isn't valid and we reference self.poolMax
142
152
  // (which is a C layer getter) an error will be thrown.
@@ -154,7 +164,7 @@ function getConnection(getConnectionCb) {
154
164
  }
155
165
 
156
166
  if (self.queueRequests === false) { // queueing is disabled for pool
157
- self._getConnection(function(err, connInst) {
167
+ self._getConnection(options, function(err, connInst) {
158
168
  if (err) {
159
169
  if (self._enableStats) {
160
170
  self._totalFailedRequests += 1;
@@ -170,7 +180,7 @@ function getConnection(getConnectionCb) {
170
180
  getConnectionCb(null, connInst);
171
181
  });
172
182
  } else if (self._connectionsOut < self.poolMax) { // queueing enabled, but not needed
173
- completeConnectionRequest.call(self, getConnectionCb);
183
+ completeConnectionRequest.call(self, options, getConnectionCb);
174
184
  } else { // need to queue the request
175
185
  if (self._usingQueueTimeout) {
176
186
  self._connRequestTimersIdx += 1;
@@ -187,7 +197,8 @@ function getConnection(getConnectionCb) {
187
197
  payload = {
188
198
  timerIdx: timerIdx,
189
199
  timeoutHandle: timeoutHandle,
190
- getConnectionCb: getConnectionCb
200
+ getConnectionCb: getConnectionCb,
201
+ config : options
191
202
  };
192
203
 
193
204
  if (self._usingQueueTimeout) {
@@ -206,24 +217,24 @@ function getConnection(getConnectionCb) {
206
217
 
207
218
  getConnectionPromisified = nodbUtil.promisify(getConnection);
208
219
 
209
- function terminate(terminateCb) {
220
+ function close(closeCb) {
210
221
  var self = this;
211
222
 
212
223
  nodbUtil.assert(arguments.length === 1, 'NJS-009');
213
- nodbUtil.assert(typeof terminateCb === 'function', 'NJS-006', 1);
224
+ nodbUtil.assert(typeof closeCb === 'function', 'NJS-006', 1);
214
225
 
215
- self._terminate(function(err) {
226
+ self._close(function(err) {
216
227
  if (!err) {
217
228
  self._isValid = false;
218
229
 
219
230
  self.emit('_after_close', self);
220
231
  }
221
232
 
222
- terminateCb(err);
233
+ closeCb(err);
223
234
  });
224
235
  }
225
236
 
226
- terminatePromisified = nodbUtil.promisify(terminate);
237
+ closePromisified = nodbUtil.promisify(close);
227
238
 
228
239
  // logStats is used to add a hidden method (_logStats) to each pool instance. This
229
240
  // provides an easy way to log out the statistics related information that's collected
@@ -323,7 +334,7 @@ function extend(pool, poolAttrs, poolAlias, oracledb) {
323
334
  throw new Error(nodbUtil.getErrorMessage('NJS-014', 'queueTimeout'));
324
335
  }
325
336
  },
326
- _isValid: { // used to ensure operations are not done after terminate
337
+ _isValid: { // used to ensure operations are not done after close
327
338
  value: true,
328
339
  writable: true
329
340
  },
@@ -408,16 +419,16 @@ function extend(pool, poolAttrs, poolAlias, oracledb) {
408
419
  enumerable: true,
409
420
  writable: true
410
421
  },
411
- _terminate: {
412
- value: pool.terminate
422
+ _close: {
423
+ value: pool.close
413
424
  },
414
- terminate: {
415
- value: terminatePromisified,
425
+ close: {
426
+ value: closePromisified,
416
427
  enumerable: true,
417
428
  writable: true
418
429
  },
419
- close: { // alias for terminate
420
- value: terminatePromisified,
430
+ terminate: { // alias for close
431
+ value: closePromisified,
421
432
  enumerable: true,
422
433
  writable: true
423
434
  }
@@ -48,7 +48,8 @@ function QueryStream(resultSet, oracledb) {
48
48
  );
49
49
 
50
50
  Readable.call(self, {
51
- objectMode: true
51
+ objectMode: true,
52
+ emitClose: false // Prevents duplicate close events
52
53
  });
53
54
 
54
55
  // Check if QueryStream was created via ResultSet.toQueryStream() then the
@@ -69,7 +70,7 @@ function QueryStream(resultSet, oracledb) {
69
70
  // Using setImmediate to ensure that end event handlers are processed
70
71
  // before the destroy logic is invoked.
71
72
  setImmediate(function() {
72
- self.destroy();
73
+ self._destroy(null, function() {});
73
74
  });
74
75
  });
75
76
  }
package/lib/rel.txt CHANGED
@@ -1 +1 @@
1
- 339089fa3be02c1506a593b47f5e994cc674b762 Mon 12 Feb 2018 04:22:26 UTC
1
+ 88e5d8dd1201e3d0244e8264cf1d0652b2be378e Tue 5 Jun 2018 07:13:28 UTC
package/odpi/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
1
+ Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
  This program is free software: you can modify it and/or redistribute it under
4
4
  the terms of: