oracledb 3.1.2 → 4.2.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 (53) hide show
  1. package/CHANGELOG.md +277 -4
  2. package/LICENSE.md +5906 -360
  3. package/README.md +7 -8
  4. package/build/Release/oracledb-4.2.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-4.2.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-4.2.0-linux-x64.node +0 -0
  7. package/build/Release/oracledb-4.2.0-linux-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-4.2.0-win32-x64.node +0 -0
  9. package/build/Release/oracledb-4.2.0-win32-x64.node-buildinfo.txt +1 -0
  10. package/lib/aqDeqOptions.js +29 -0
  11. package/lib/aqEnqOptions.js +29 -0
  12. package/lib/aqMessage.js +29 -0
  13. package/lib/aqQueue.js +84 -0
  14. package/lib/connection.js +294 -326
  15. package/lib/dbObject.js +144 -0
  16. package/lib/lob.js +125 -132
  17. package/lib/oracledb.js +162 -483
  18. package/lib/pool.js +95 -109
  19. package/lib/{querystream.js → queryStream.js} +31 -30
  20. package/lib/resultset.js +75 -125
  21. package/lib/sodaCollection.js +99 -165
  22. package/lib/sodaDatabase.js +58 -133
  23. package/lib/sodaDocCursor.js +27 -70
  24. package/lib/sodaDocument.js +35 -65
  25. package/lib/sodaOperation.js +96 -252
  26. package/lib/util.js +78 -71
  27. package/package/README.md +41 -36
  28. package/package/install.js +30 -24
  29. package/package.json +2 -2
  30. package/build/Release/oracledb-abi48-darwin-x64.node +0 -0
  31. package/build/Release/oracledb-abi48-darwin-x64.node-buildinfo.txt +0 -1
  32. package/build/Release/oracledb-abi48-linux-x64.node +0 -0
  33. package/build/Release/oracledb-abi48-linux-x64.node-buildinfo.txt +0 -1
  34. package/build/Release/oracledb-abi48-win32-x64.node +0 -0
  35. package/build/Release/oracledb-abi48-win32-x64.node-buildinfo.txt +0 -1
  36. package/build/Release/oracledb-abi57-darwin-x64.node +0 -0
  37. package/build/Release/oracledb-abi57-darwin-x64.node-buildinfo.txt +0 -1
  38. package/build/Release/oracledb-abi57-linux-x64.node +0 -0
  39. package/build/Release/oracledb-abi57-linux-x64.node-buildinfo.txt +0 -1
  40. package/build/Release/oracledb-abi57-win32-x64.node +0 -0
  41. package/build/Release/oracledb-abi57-win32-x64.node-buildinfo.txt +0 -1
  42. package/build/Release/oracledb-abi64-darwin-x64.node +0 -0
  43. package/build/Release/oracledb-abi64-darwin-x64.node-buildinfo.txt +0 -1
  44. package/build/Release/oracledb-abi64-linux-x64.node +0 -0
  45. package/build/Release/oracledb-abi64-linux-x64.node-buildinfo.txt +0 -1
  46. package/build/Release/oracledb-abi64-win32-x64.node +0 -0
  47. package/build/Release/oracledb-abi64-win32-x64.node-buildinfo.txt +0 -1
  48. package/build/Release/oracledb-abi67-darwin-x64.node +0 -0
  49. package/build/Release/oracledb-abi67-darwin-x64.node-buildinfo.txt +0 -1
  50. package/build/Release/oracledb-abi67-linux-x64.node +0 -0
  51. package/build/Release/oracledb-abi67-linux-x64.node-buildinfo.txt +0 -1
  52. package/build/Release/oracledb-abi67-win32-x64.node +0 -0
  53. package/build/Release/oracledb-abi67-win32-x64.node-buildinfo.txt +0 -1
package/lib/oracledb.js CHANGED
@@ -1,53 +1,80 @@
1
- /* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /******************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- *****************************************************************************/
1
+ // Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // You may not use the identified files except in compliance with the Apache
6
+ // License, Version 2.0 (the "License.")
7
+ //
8
+ // You may obtain a copy of the License at
9
+ // http://www.apache.org/licenses/LICENSE-2.0.
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ //
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ //
18
+ //-----------------------------------------------------------------------------
19
19
 
20
20
  'use strict';
21
21
 
22
- var oracledbCLib;
23
- var oracledbInst;
24
- var Lob = require('./lob.js').Lob;
25
- var pool = require('./pool.js');
26
- var connection = require('./connection.js');
27
- var nodbUtil = require('./util.js');
28
- var createPoolPromisified;
29
- var getConnectionPromisified;
30
- var poolCache = {};
31
- var tempUsedPoolAliases = {};
32
- var defaultPoolAlias = 'default';
22
+ const nodbUtil = require('./util.js');
23
+ const util = require('util');
24
+
25
+ // This version of node-oracledb works with Node.js 8.16, 10.16 or
26
+ // later. The test stops hard-to-interpret runtime errors and crashes
27
+ // with older Node.js versions. Also Node.js 8.16 and 10.16 (and
28
+ // 12.0) contain an important N-API performance regression fix. If
29
+ // you're using the obsolete Node.js 9 or 11 versions, you're on your
30
+ // own regarding performance and functionality
31
+ let vs = process.version.substring(1).split(".").map(Number);
32
+ if (vs[0] < 8 || (vs[0] === 8 && vs[1] < 16)) {
33
+ throw new Error(nodbUtil.getErrorMessage('NJS-069', nodbUtil.PACKAGE_JSON_VERSION, "8.16"));
34
+ } else if ((vs[0] === 10 && vs[1] < 16)) {
35
+ throw new Error(nodbUtil.getErrorMessage('NJS-069', nodbUtil.PACKAGE_JSON_VERSION, "10.16"));
36
+ }
37
+
38
+ const AqDeqOptions = require('./aqDeqOptions.js');
39
+ const AqEnqOptions = require('./aqEnqOptions.js');
40
+ const AqMessage = require('./aqMessage.js');
41
+ const AqQueue = require('./aqQueue.js');
42
+ const BaseDbObject = require('./dbObject.js');
43
+ const Connection = require('./connection.js');
44
+ const Lob = require('./lob.js');
45
+ const Pool = require('./pool.js');
46
+ const ResultSet = require('./resultset.js');
47
+ const SodaDatabase = require('./sodaDatabase.js');
48
+ const SodaCollection = require('./sodaCollection.js');
49
+ const SodaDocCursor = require('./sodaDocCursor.js');
50
+ const SodaDocument = require('./sodaDocument.js');
51
+ const SodaOperation = require('./sodaOperation.js');
52
+
53
+ let poolCache = {};
54
+ let tempUsedPoolAliases = {};
55
+ const defaultPoolAlias = 'default';
33
56
 
34
57
  // Load the Oracledb binary
35
58
 
36
- var binaryLocations = [
59
+ const binaryLocations = [
37
60
  '../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE, // pre-built binary
38
61
  '../' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node', // binary built from source
39
- '../build/Debug/oracledb.node' // debug binary
62
+ '../build/Debug/oracledb.node', // debug binary
63
+ // Ease Webpack use, see https://github.com/oracle/node-oracledb/issues/1156
64
+ './node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE,
65
+ './node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node'
40
66
  ];
41
67
 
42
- for (var i = 0; i < binaryLocations.length; i++) {
68
+ let oracledbCLib;
69
+ for (let i = 0; i < binaryLocations.length; i++) {
43
70
  try {
44
71
  oracledbCLib = require(binaryLocations[i]);
45
72
  break;
46
73
  } catch(err) {
47
74
  if (err.code !== 'MODULE_NOT_FOUND' || i == binaryLocations.length - 1) {
48
- var nodeInfo;
75
+ let nodeInfo;
49
76
  if (err.code === 'MODULE_NOT_FOUND') {
50
- // none of the three binaries could be found
77
+ // a binary was not found in any of the search directories
51
78
  nodeInfo = `\n Looked for ${binaryLocations.map(x => require('path').resolve(__dirname, x)).join(', ')}\n ${nodbUtil.getInstallURL()}\n`;
52
79
  } else {
53
80
  nodeInfo = `\n Node.js require('oracledb') error was:\n ${err.message}\n ${nodbUtil.getInstallHelp()}\n`;
@@ -57,30 +84,67 @@ for (var i = 0; i < binaryLocations.length; i++) {
57
84
  }
58
85
  }
59
86
 
87
+
88
+ class OracleDb {
89
+
90
+ constructor() {
91
+ this.queueTimeout = 60000;
92
+ this.Promise = global.Promise;
93
+ }
94
+
95
+ // extend class with promisified functions
96
+ _extend(oracleDbInst) {
97
+ this.getConnection = nodbUtil.promisify(oracleDbInst, getConnection);
98
+ this.createPool = nodbUtil.promisify(oracleDbInst, createPool);
99
+ }
100
+
101
+ // temporary method for determining if an object is a date until
102
+ // napi_is_date() can be used (when N-API v5 can be used)
103
+ _isDate(val) {
104
+ return util.isDate(val);
105
+ }
106
+
107
+ // retrieves a pool from the pool cache (synchronous method)
108
+ getPool(poolAlias) {
109
+ let pool;
110
+
111
+ nodbUtil.checkArgCount(arguments, 0, 1);
112
+
113
+ if (poolAlias) {
114
+ nodbUtil.assert(typeof poolAlias === 'string' || typeof poolAlias === 'number', 'NJS-005', 1);
115
+ }
116
+
117
+ poolAlias = poolAlias || defaultPoolAlias;
118
+
119
+ pool = poolCache[poolAlias];
120
+
121
+ if (!pool) {
122
+ throw new Error(nodbUtil.getErrorMessage('NJS-047', poolAlias));
123
+ }
124
+
125
+ return pool;
126
+ }
127
+
128
+ }
129
+
60
130
  // Oracledb functions and classes
61
131
 
62
- oracledbCLib.Oracledb.prototype.newLob = function(iLob) {
63
- return new Lob(iLob, null, oracledbInst);
64
- };
132
+ // oracledbCLib.OracleDb.prototype.newLob = function(iLob) {
133
+ // return new Lob(iLob, null, oracledbInst);
134
+ // };
65
135
 
66
136
  // This createPool function is used the override the createPool method of the
67
137
  // Oracledb class, which is defined in the C layer. The override allows us to do
68
138
  // things like extend out the pool instance prior to passing it to the caller.
69
139
  function createPool(poolAttrs, createPoolCb) {
70
- var self = this;
71
- var sessionCallback;
72
- var poolAlias;
140
+ const self = this;
141
+ let sessionCallback;
142
+ let poolAlias;
73
143
 
74
144
  // Initial argument count and type checks are done first and throw in the same
75
145
  // call stack.
76
- nodbUtil.assert(arguments.length === 2, 'NJS-009');
77
- nodbUtil.assert(nodbUtil.isObject(poolAttrs), 'NJS-006', 1);
78
- nodbUtil.assert(typeof createPoolCb === 'function', 'NJS-006', 2);
79
-
80
- // Allow user to use connectionString as an alias for connectString.
81
- if (poolAttrs.connectString === undefined) {
82
- poolAttrs.connectString = poolAttrs.connectionString;
83
- }
146
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
147
+ nodbUtil.assert(nodbUtil.isObject(poolAttrs), 'NJS-005', 1);
84
148
 
85
149
  // Additional validations should pass errors via the callback. Need to ensure
86
150
  // that errors are raised prior to actually creating the pool via _createPool.
@@ -110,9 +174,22 @@ function createPool(poolAttrs, createPoolCb) {
110
174
  // be called by the database when a connection acquired from the pool doesn't
111
175
  // have the requested tag
112
176
  sessionCallback = poolAttrs.sessionCallback;
177
+
178
+ // create an adjusted set of pool attributes to pass to the C layer; the
179
+ // session callback must be removed if it is a JavaScript function and the
180
+ // queue timeout is used to specify the maximum amount of time that the C
181
+ // layer will wait for a connection to be returned; ordinarily since the
182
+ // JavaScript layer never calls the C layer to get a connection unless one is
183
+ // known to be available, this should not be needed, but in some cases (such
184
+ // as when the maximum for a particular shard is specified) this may not be
185
+ // known, so this prevents an unnecessarily long wait from taking place
186
+ const adjustedPoolAttrs = Object.defineProperties({},
187
+ Object.getOwnPropertyDescriptors(poolAttrs));
113
188
  if (typeof poolAttrs.sessionCallback === 'function') {
114
- poolAttrs = Object.assign({}, poolAttrs);
115
- delete poolAttrs.sessionCallback;
189
+ delete adjustedPoolAttrs.sessionCallback;
190
+ }
191
+ if (adjustedPoolAttrs.queueTimeout === undefined) {
192
+ adjustedPoolAttrs.queueTimeout = self.queueTimeout;
116
193
  }
117
194
 
118
195
  // Need to prevent another call in the same stack from succeeding, otherwise
@@ -122,7 +199,7 @@ function createPool(poolAttrs, createPoolCb) {
122
199
  tempUsedPoolAliases[poolAlias] = true;
123
200
  }
124
201
 
125
- self._createPool(poolAttrs, function(err, poolInst) {
202
+ self._createPool(adjustedPoolAttrs, function(err, poolInst) {
126
203
  if (err) {
127
204
  // We need to free this up since the creation of the pool failed.
128
205
  if (poolAlias) {
@@ -144,11 +221,10 @@ function createPool(poolAttrs, createPoolCb) {
144
221
  delete tempUsedPoolAliases[poolAlias];
145
222
  }
146
223
 
147
- poolAttrs.sessionCallback = sessionCallback;
148
- pool.extend(poolInst, poolAttrs, poolAlias, self);
224
+ poolInst._setup(poolAttrs, poolAlias, self);
149
225
 
150
226
  poolInst.on('_after_close', function() {
151
- var pool = this;
227
+ const pool = this;
152
228
 
153
229
  if (pool.poolAlias) {
154
230
  delete poolCache[pool.poolAlias];
@@ -159,55 +235,27 @@ function createPool(poolAttrs, createPoolCb) {
159
235
  });
160
236
  }
161
237
 
162
- createPoolPromisified = nodbUtil.promisify(createPool);
163
-
164
- // The getPool function is a synchronous method used to retrieve pools from the
165
- // pool cache.
166
- function getPool(poolAlias) {
167
- var pool;
168
-
169
- nodbUtil.assert(arguments.length < 2, 'NJS-009');
170
-
171
- if (poolAlias) {
172
- nodbUtil.assert(typeof poolAlias === 'string' || typeof poolAlias === 'number', 'NJS-006', 1);
173
- }
174
-
175
- poolAlias = poolAlias || defaultPoolAlias;
176
-
177
- pool = poolCache[poolAlias];
178
-
179
- if (!pool) {
180
- throw new Error(nodbUtil.getErrorMessage('NJS-047', poolAlias));
181
- }
182
-
183
- return pool;
184
- }
185
-
186
238
  // This getConnection function is used the override the getConnection method of the
187
239
  // Oracledb class, which is defined in the C layer. The override allows us to do
188
240
  // things like extend out the connection instance prior to passing it to the caller.
189
241
  function getConnection(a1, a2) {
190
- var self = this;
191
- var pool;
192
- var poolAlias;
193
- var connAttrs = {};
194
- var getConnectionCb;
242
+ const self = this;
243
+ let pool;
244
+ let poolAlias;
245
+ let connAttrs = {};
246
+ let getConnectionCb;
195
247
 
196
- nodbUtil.assert(arguments.length < 3, 'NJS-009');
248
+ nodbUtil.checkAsyncArgs(arguments, 1, 2);
197
249
 
198
250
  // Verify the number and types of arguments, then initialize the local poolAlias,
199
251
  // connAttrs, and getConnectionCb variables based on the arguments.
200
252
  switch (arguments.length) {
201
253
  case 1:
202
- nodbUtil.assert(typeof a1 === 'function', 'NJS-006', 1);
203
-
204
254
  poolAlias = defaultPoolAlias;
205
255
  getConnectionCb = a1;
206
-
207
256
  break;
208
257
  case 2:
209
- nodbUtil.assert(typeof a1 === 'string' || nodbUtil.isObject(a1), 'NJS-006', 1);
210
- nodbUtil.assert(typeof a2 === 'function', 'NJS-006', 2);
258
+ nodbUtil.assert(typeof a1 === 'string' || nodbUtil.isObject(a1), 'NJS-005', 1);
211
259
 
212
260
  if (typeof a1 === 'string') {
213
261
  poolAlias = a1;
@@ -236,11 +284,6 @@ function getConnection(a1, a2) {
236
284
 
237
285
  pool.getConnection(connAttrs, getConnectionCb);
238
286
  } else {
239
- // Allow user to use connectionString as an alias for connectString.
240
- if (connAttrs.connectString === undefined) {
241
- connAttrs.connectString = connAttrs.connectionString;
242
- }
243
-
244
287
  self._getConnection(connAttrs, function(err, connInst) {
245
288
  if (err) {
246
289
  if (err.message.match(/DPI-1047/)) {
@@ -250,397 +293,33 @@ function getConnection(a1, a2) {
250
293
  return;
251
294
  }
252
295
 
253
- connection.extend(connInst, self);
254
-
255
296
  getConnectionCb(null, connInst);
256
297
  });
257
298
  }
258
299
  }
259
300
 
260
- getConnectionPromisified = nodbUtil.promisify(getConnection);
261
-
262
- // The extend method is used to extend the Oracledb instance from the C layer with
263
- // custom properties and method overrides. References to the original methods are
264
- // maintained so they can be invoked by the overriding method at the right time.
265
- function extend(oracledb) {
266
- // Using Object.defineProperties to add properties to the Oracledb instance with
267
- // special properties, such as enumerable but not writable. A number of constants
268
- // (uppercase names) are added for use in various method calls.
269
- Object.defineProperties(
270
- oracledb,
271
- {
272
- _oracledb: { // Known to be used in util.js' promisify function.
273
- value: oracledb
274
- },
275
- DEFAULT: {
276
- value: 0,
277
- enumerable: true
278
- },
279
- CQN_OPCODE_ALL_OPS: {
280
- value: 0,
281
- enumerable: true
282
- },
283
- CQN_OPCODE_ALL_ROWS: {
284
- value: 1,
285
- enumerable: true
286
- },
287
- CQN_OPCODE_ALTER: {
288
- value: 16,
289
- enumerable: true
290
- },
291
- CQN_OPCODE_DELETE: {
292
- value: 8,
293
- enumerable: true
294
- },
295
- CQN_OPCODE_DROP: {
296
- value: 32,
297
- enumerable: true
298
- },
299
- CQN_OPCODE_INSERT: {
300
- value: 2,
301
- enumerable: true
302
- },
303
- CQN_OPCODE_UPDATE: {
304
- value: 4,
305
- enumerable: true
306
- },
307
- DB_TYPE_VARCHAR: {
308
- value: 1,
309
- enumerable: true
310
- },
311
- DB_TYPE_NUMBER: {
312
- value: 2,
313
- enumerable: true
314
- },
315
- DB_TYPE_LONG: {
316
- value: 8,
317
- enumerable: true
318
- },
319
- DB_TYPE_DATE: {
320
- value: 12,
321
- enumerable: true
322
- },
323
- DB_TYPE_RAW: {
324
- value: 23,
325
- enumerable: true
326
- },
327
- DB_TYPE_LONG_RAW: {
328
- value: 24,
329
- enumerable: true
330
- },
331
- DB_TYPE_CHAR: {
332
- value: 96,
333
- enumerable: true
334
- },
335
- DB_TYPE_BINARY_FLOAT: {
336
- value: 100,
337
- enumerable: true
338
- },
339
- DB_TYPE_BINARY_DOUBLE: {
340
- value: 101,
341
- enumerable: true
342
- },
343
- DB_TYPE_ROWID: {
344
- value: 104,
345
- enumerable: true
346
- },
347
- DB_TYPE_CLOB: {
348
- value: 112,
349
- enumerable: true
350
- },
351
- DB_TYPE_BLOB: {
352
- value: 113,
353
- enumerable: true
354
- },
355
- DB_TYPE_TIMESTAMP: {
356
- value: 187,
357
- enumerable: true
358
- },
359
- DB_TYPE_TIMESTAMP_TZ: {
360
- value: 188,
361
- enumerable: true
362
- },
363
- DB_TYPE_TIMESTAMP_LTZ: {
364
- value: 232,
365
- enumerable: true
366
- },
367
- DB_TYPE_NVARCHAR: {
368
- value : 1001,
369
- enumerable : true
370
- },
371
- DB_TYPE_NCHAR: {
372
- value : 1096,
373
- enumerable : true
374
- },
375
- DB_TYPE_NCLOB: {
376
- value : 1112,
377
- enumerable : true
378
- },
379
- STMT_TYPE_UNKNOWN: {
380
- value : 0,
381
- enumerable : true
382
- },
383
- STMT_TYPE_SELECT: {
384
- value : 1,
385
- enumerable : true
386
- },
387
- STMT_TYPE_UPDATE: {
388
- value : 2,
389
- enumerable : true
390
- },
391
- STMT_TYPE_DELETE: {
392
- value : 3,
393
- enumerable : true
394
- },
395
- STMT_TYPE_INSERT: {
396
- value : 4,
397
- enumerable : true
398
- },
399
- STMT_TYPE_CREATE: {
400
- value : 5,
401
- enumerable : true
402
- },
403
- STMT_TYPE_DROP: {
404
- value : 6,
405
- enumerable : true
406
- },
407
- STMT_TYPE_ALTER: {
408
- value : 7,
409
- enumerable : true
410
- },
411
- STMT_TYPE_BEGIN: {
412
- value : 8,
413
- enumerable : true
414
- },
415
- STMT_TYPE_DECLARE: {
416
- value : 9,
417
- enumerable : true
418
- },
419
- STMT_TYPE_CALL: {
420
- value : 10,
421
- enumerable : true
422
- },
423
- STMT_TYPE_EXPLAIN_PLAN: {
424
- value : 15,
425
- enumerable : true
426
- },
427
- STMT_TYPE_MERGE: {
428
- value : 16,
429
- enumerable : true
430
- },
431
- STMT_TYPE_ROLLBACK: {
432
- value : 17,
433
- enumerable : true
434
- },
435
- STMT_TYPE_COMMIT: {
436
- value : 21,
437
- enumerable : true
438
- },
439
- STRING: {
440
- value: 2001,
441
- enumerable: true
442
- },
443
- SUBSCR_EVENT_TYPE_DEREG: {
444
- value: 5,
445
- enumerable: true
446
- },
447
- SUBSCR_EVENT_TYPE_OBJ_CHANGE: {
448
- value: 6,
449
- enumerable: true
450
- },
451
- SUBSCR_EVENT_TYPE_QUERY_CHANGE: {
452
- value: 7,
453
- enumerable: true
454
- },
455
- SUBSCR_EVENT_TYPE_AQ: {
456
- value: 100,
457
- enumerable: true
458
- },
459
- SUBSCR_GROUPING_CLASS_TIME: {
460
- value: 1,
461
- enumerable: true
462
- },
463
- SUBSCR_GROUPING_TYPE_SUMMARY: {
464
- value: 1,
465
- enumerable: true
466
- },
467
- SUBSCR_GROUPING_TYPE_LAST: {
468
- value: 2,
469
- enumerable: true
470
- },
471
- SUBSCR_NAMESPACE_AQ: {
472
- value: 1,
473
- enumerable: true
474
- },
475
- SUBSCR_NAMESPACE_DBCHANGE: {
476
- value: 2,
477
- enumerable: true
478
- },
479
- SUBSCR_QOS_BEST_EFFORT: {
480
- value: 16,
481
- enumerable: true
482
- },
483
- SUBSCR_QOS_DEREG_NFY: {
484
- value: 2,
485
- enumerable: true
486
- },
487
- SUBSCR_QOS_QUERY: {
488
- value: 8,
489
- enumerable: true
490
- },
491
- SUBSCR_QOS_RELIABLE: {
492
- value: 1,
493
- enumerable: true
494
- },
495
- SUBSCR_QOS_ROWIDS: {
496
- value: 4,
497
- enumerable: true
498
- },
499
- NUMBER: {
500
- value: 2002,
501
- enumerable: true
502
- },
503
- DATE: {
504
- value: 2003,
505
- enumerable: true
506
- },
507
- CURSOR: {
508
- value: 2004,
509
- enumerable: true
510
- },
511
- BUFFER: {
512
- value: 2005,
513
- enumerable: true
514
- },
515
- CLOB: {
516
- value: 2006,
517
- enumerable: true
518
- },
519
- BLOB: {
520
- value: 2007,
521
- enumerable: true
522
- },
523
- SYSDBA: {
524
- value: 2,
525
- enumerable: true
526
- },
527
- SYSOPER: {
528
- value: 4,
529
- enumerable: true
530
- },
531
- SYSASM: {
532
- value: 32768,
533
- enumerable: true
534
- },
535
- SYSBACKUP: {
536
- value: 131072,
537
- enumerable: true
538
- },
539
- SYSDG: {
540
- value: 262144,
541
- enumerable: true
542
- },
543
- SYSKM: {
544
- value: 524288,
545
- enumerable: true
546
- },
547
- SYSRAC: {
548
- value: 1048576,
549
- enumerable: true
550
- },
551
- BIND_IN: {
552
- value: 3001,
553
- enumerable: true
554
- },
555
- BIND_INOUT: {
556
- value: 3002,
557
- enumerable: true
558
- },
559
- BIND_OUT: {
560
- value: 3003,
561
- enumerable: true
562
- },
563
- ARRAY: {
564
- value: 4001,
565
- enumerable: true
566
- },
567
- OBJECT: {
568
- value: 4002,
569
- enumerable: true
570
- },
571
- SODA_COLL_MAP_MODE: {
572
- value: 5001,
573
- enumerable : true
574
- },
575
- POOL_STATUS_OPEN: {
576
- value: 6000,
577
- enumerable: true
578
- },
579
- POOL_STATUS_DRAINING: {
580
- value: 6001,
581
- enumerable: true
582
- },
583
- POOL_STATUS_CLOSED: {
584
- value: 6002,
585
- enumerable: true
586
- },
587
- Promise: {
588
- value: global.Promise,
589
- enumerable: true,
590
- writable: true
591
- },
592
- Oracledb: {
593
- value: oracledbCLib.Oracledb,
594
- enumerable: true
595
- },
596
- Connection: {
597
- value: oracledbCLib.Connection,
598
- enumerable: true
599
- },
600
- Lob: {
601
- value: Lob,
602
- enumerable: true
603
- },
604
- Pool: {
605
- value: oracledbCLib.Pool,
606
- enumerable: true
607
- },
608
- ResultSet: {
609
- value: oracledbCLib.ResultSet,
610
- enumerable: true
611
- },
612
- queueTimeout: {
613
- value: 60000,
614
- enumerable: true,
615
- writable: true
616
- },
617
- _createPool: {
618
- value: oracledb.createPool
619
- },
620
- createPool: {
621
- value: createPoolPromisified,
622
- enumerable: true,
623
- writable: true
624
- },
625
- getPool: {
626
- value: getPool,
627
- enumerable: true,
628
- writable: true
629
- },
630
- _getConnection: {
631
- value: oracledb.getConnection
632
- },
633
- getConnection: {
634
- value: getConnectionPromisified,
635
- enumerable: true,
636
- writable: true
637
- }
638
- }
639
- );
640
- }
641
-
642
- oracledbInst = new oracledbCLib.Oracledb();
643
-
644
- extend(oracledbInst);
645
-
646
- module.exports = oracledbInst;
301
+ // create instance which will be exported
302
+ let oracleDbInst = new OracleDb();
303
+
304
+ // add classes to prototype
305
+ let proto = Object.getPrototypeOf(oracleDbInst);
306
+ proto.OracleDb = OracleDb;
307
+ proto.AqDeqOptions = AqDeqOptions;
308
+ proto.AqEnqOptions = AqEnqOptions;
309
+ proto.AqMessage = AqMessage;
310
+ proto.AqQueue = AqQueue;
311
+ proto.BaseDbObject = BaseDbObject;
312
+ proto.Connection = Connection;
313
+ proto.Lob = Lob;
314
+ proto.Pool = Pool;
315
+ proto.ResultSet = ResultSet;
316
+ proto.SodaDatabase = SodaDatabase;
317
+ proto.SodaCollection = SodaCollection;
318
+ proto.SodaDocCursor = SodaDocCursor;
319
+ proto.SodaDocument = SodaDocument;
320
+ proto.SodaOperation = SodaOperation;
321
+
322
+ // call C to extend classes
323
+ oracledbCLib.init(oracleDbInst);
324
+
325
+ module.exports = oracleDbInst;