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/resultset.js CHANGED
@@ -1,36 +1,32 @@
1
- /* Copyright (c) 2016, 2018, 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) 2016, 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
+ //-----------------------------------------------------------------------------
19
19
 
20
20
  'use strict';
21
21
 
22
- var QueryStream = require('./querystream.js');
23
- var nodbUtil = require('./util.js');
24
- var closePromisified;
25
- var getRowPromisified;
26
- var getRowsPromisified;
22
+ const QueryStream = require('./queryStream.js');
23
+ const nodbUtil = require('./util.js');
27
24
 
28
- // This close function is just a place holder to allow for easier extension later.
25
+ // close the result set
29
26
  function close(closeCb) {
30
- var self = this;
27
+ const self = this;
31
28
 
32
- nodbUtil.assert(arguments.length === 1, 'NJS-009');
33
- nodbUtil.assert(typeof closeCb === 'function', 'NJS-006', 1);
29
+ nodbUtil.checkAsyncArgs(arguments, 1, 1);
34
30
 
35
31
  if (self._convertedToStream) {
36
32
  closeCb(new Error(nodbUtil.getErrorMessage('NJS-042')));
@@ -45,16 +41,14 @@ function close(closeCb) {
45
41
  });
46
42
  }
47
43
 
48
- closePromisified = nodbUtil.promisify(close);
49
44
 
50
- // getRow is a JavaScript based wrapper on getRows. It buffers rows in a JavaScript
51
- // array to avoid the trips through the thread pool that would be required if
52
- // implemented in C.
45
+ // getRow is a JavaScript based wrapper on getRows. It buffers rows in a
46
+ // JavaScript array to avoid the trips through the thread pool that would be
47
+ // required if implemented in C.
53
48
  function getRow(getRowCb) {
54
- var self = this;
49
+ const self = this;
55
50
 
56
- nodbUtil.assert(arguments.length === 1, 'NJS-009');
57
- nodbUtil.assert(typeof getRowCb === 'function', 'NJS-006', 1);
51
+ nodbUtil.checkAsyncArgs(arguments, 1, 1);
58
52
 
59
53
  if (self._convertedToStream && !self._allowGetRowCall) {
60
54
  getRowCb(new Error(nodbUtil.getErrorMessage('NJS-042')));
@@ -85,19 +79,19 @@ function getRow(getRowCb) {
85
79
  });
86
80
  }
87
81
 
88
- getRowPromisified = nodbUtil.promisify(getRow);
89
82
 
90
- // The JS getRows will first check to see if any rows are in the JS buffer (which
91
- // could result from interspersed calls to getRow and getRows). If no rows are in the
92
- // buffer, the call is just proxied to the C layer. Otherwise, rows are pulled from
93
- // the buffer and potentially concatenated with rows from a call to getRows.
83
+ // The JS getRows will first check to see if any rows are in the JS buffer
84
+ // (which could result from interspersed calls to getRow and getRows). If no
85
+ // rows are in the buffer, the call is just proxied to the C layer. Otherwise,
86
+ // rows are pulled from the buffer and potentially concatenated with rows from
87
+ // a call to getRows.
94
88
  function getRows(numRows, getRowsCb) {
95
- var self = this;
96
- var rowsNeeded;
89
+ const self = this;
90
+ let rowsNeeded;
97
91
 
98
- nodbUtil.assert(arguments.length === 2, 'NJS-009');
99
- nodbUtil.assert(typeof numRows === 'number', 'NJS-006', 1);
100
- nodbUtil.assert(typeof getRowsCb === 'function', 'NJS-006', 2);
92
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
93
+ nodbUtil.assert(Number.isInteger(numRows), 'NJS-005', 2);
94
+ nodbUtil.assert(numRows > 0, 'NJS-005', 2);
101
95
 
102
96
  if (self._convertedToStream) {
103
97
  getRowsCb(new Error(nodbUtil.getErrorMessage('NJS-042')));
@@ -107,7 +101,7 @@ function getRows(numRows, getRowsCb) {
107
101
  self._processingStarted = true;
108
102
 
109
103
  if (self._rowCache.length === 0) {
110
- self._getRows.apply(self, arguments);
104
+ self._getRows(numRows, getRowsCb);
111
105
  } else {
112
106
  rowsNeeded = numRows - self._rowCache.length;
113
107
 
@@ -115,7 +109,7 @@ function getRows(numRows, getRowsCb) {
115
109
  getRowsCb(null, self._rowCache.splice(0, numRows));
116
110
  } else {
117
111
  self._getRows(rowsNeeded, function(err, rows) {
118
- var requestedRows;
112
+ let requestedRows;
119
113
 
120
114
  if (err) {
121
115
  getRowsCb(err);
@@ -132,97 +126,53 @@ function getRows(numRows, getRowsCb) {
132
126
  }
133
127
  }
134
128
 
135
- getRowsPromisified = nodbUtil.promisify(getRows);
136
129
 
137
- function toQueryStream() {
138
- var self = this;
139
- var stream;
130
+ class ResultSet {
140
131
 
141
- nodbUtil.assert(arguments.length === 0, 'NJS-009');
132
+ constructor() {
133
+ this._rowCache = [];
134
+ this._processingStarted = false;
135
+ this._convertedToStream = false;
136
+ this._allowGetRowCall = false;
137
+ }
142
138
 
143
- if (self._processingStarted) {
144
- throw new Error(nodbUtil.getErrorMessage('NJS-041'));
139
+ _extend(oracledb) {
140
+ this._oracledb = oracledb;
141
+ this.close = nodbUtil.promisify(oracledb, close);
142
+ this.getRow = nodbUtil.promisify(oracledb, getRow);
143
+ this.getRows = nodbUtil.promisify(oracledb, getRows);
145
144
  }
146
145
 
147
- if (self._convertedToStream) {
148
- throw new Error(nodbUtil.getErrorMessage('NJS-043'));
146
+ _getDbObjectClassJS(schema, name) {
147
+ return this._connection._getDbObjectClassJS(schema, name);
149
148
  }
150
149
 
151
- self._convertedToStream = true;
150
+ _setup(executeOpts) {
151
+ this._fetchArraySize = this._oracledb.fetchArraySize;
152
+ if (executeOpts && executeOpts.fetchArraySize) {
153
+ this._fetchArraySize = executeOpts.fetchArraySize;
154
+ }
155
+ }
152
156
 
153
- stream = new QueryStream(self, self._oracledb);
157
+ toQueryStream() {
158
+ const self = this;
154
159
 
155
- return stream;
156
- }
160
+ nodbUtil.checkArgCount(arguments, 0, 0);
157
161
 
158
- // The extend method is used to extend the ResultSet instance from the C layer with
159
- // custom properties and method overrides. References to the original methods are
160
- // maintained so they can be invoked by the overriding method at the right time.
161
- function extend(resultSet, oracledb, executeOpts) {
162
- var fetchArraySize = oracledb.fetchArraySize;
162
+ if (self._processingStarted) {
163
+ throw new Error(nodbUtil.getErrorMessage('NJS-041'));
164
+ }
163
165
 
164
- if (executeOpts && executeOpts.fetchArraySize) {
165
- fetchArraySize = executeOpts.fetchArraySize;
166
+ if (self._convertedToStream) {
167
+ throw new Error(nodbUtil.getErrorMessage('NJS-043'));
168
+ }
169
+
170
+ self._convertedToStream = true;
171
+
172
+ return new QueryStream(self);
166
173
  }
167
174
 
168
- // Using Object.defineProperties to add properties to the ResultSet instance with
169
- // special properties, such as enumerable but not writable.
170
- Object.defineProperties(
171
- resultSet,
172
- {
173
- _oracledb: { // storing a reference to the base instance to avoid circular references with require
174
- value: oracledb
175
- },
176
- _fetchArraySize: { // stores the value of fetchArraySize that was passed to conn.execute (if any)
177
- value: fetchArraySize
178
- },
179
- _rowCache: { // used for storing rows when getRow is used
180
- value: [],
181
- writable: true
182
- },
183
- _processingStarted: { // used to prevent conversion to stream after invoking methods
184
- value: false,
185
- writable: true
186
- },
187
- _convertedToStream: { // used to prevent invoking methods after conversion to stream
188
- value: false,
189
- writable: true
190
- },
191
- _allowGetRowCall: { // allows getRow call after conversion to queryStream
192
- value: false,
193
- writable: true
194
- },
195
- _close: {
196
- value: resultSet.close
197
- },
198
- close: {
199
- value: closePromisified,
200
- enumerable: true,
201
- writable: true
202
- },
203
- _getRow: {
204
- value: resultSet.getRow
205
- },
206
- getRow: {
207
- value: getRowPromisified,
208
- enumerable: true,
209
- writable: true
210
- },
211
- _getRows: {
212
- value: resultSet.getRows
213
- },
214
- getRows: {
215
- value: getRowsPromisified,
216
- enumerable: true,
217
- writable: true
218
- },
219
- toQueryStream: {
220
- value: toQueryStream,
221
- enumerable: true,
222
- writable: true
223
- }
224
- }
225
- );
226
175
  }
227
176
 
228
- module.exports.extend = extend;
177
+
178
+ module.exports = ResultSet;
@@ -1,235 +1,169 @@
1
- /* Copyright (c) 2018, 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) 2018, 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
+ //-----------------------------------------------------------------------------
19
19
 
20
20
  'use strict';
21
21
 
22
22
  const nodbUtil = require('./util.js');
23
- const sodaDocument = require('./sodaDocument.js');
24
- const sodaOperation = require('./sodaOperation.js');
25
-
26
- var dropCollectionPromisified;
27
- var insertOnePromisified;
28
- var insertOneAndGetPromisified;
29
- var createIndexPromisified;
30
- var dropIndexPromisified;
31
- var getDataGuidePromisified;
32
-
33
23
 
34
24
  // To drop the collection
35
25
  function drop(cb) {
36
- var self = this;
26
+ nodbUtil.checkAsyncArgs(arguments, 1, 1);
27
+ this._drop(cb);
28
+ }
37
29
 
38
- nodbUtil.assert(arguments.length === 1, 'NJS-009');
39
- nodbUtil.assert(typeof cb === 'function', 'NJS-006', 1);
40
30
 
41
- self._drop(cb);
31
+ // To insert a given document to the current collection
32
+ function insertMany(docs, cb) {
33
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
34
+ nodbUtil.assert(Array.isArray(docs), 'NJS-005', 1);
35
+
36
+ if (docs.length == 0) {
37
+ cb(new Error(nodbUtil.getErrorMessage('NJS-005', 1)));
38
+ return;
39
+ }
40
+
41
+ let actualDocs = Array(docs.length);
42
+ for (let i = 0; i < docs.length; i++) {
43
+ let content = docs[i];
44
+ if (!nodbUtil.isSodaDocument(content)) {
45
+ content = Buffer.from(JSON.stringify(content));
46
+ }
47
+ actualDocs[i] = content;
48
+ }
49
+
50
+ this._insertMany(actualDocs, cb);
42
51
  }
43
52
 
44
- dropCollectionPromisified = nodbUtil.promisify(drop);
45
53
 
54
+ // To insert a given document into the current collection and return the
55
+ // metadata of the new document (result-document)
56
+ function insertManyAndGet(docs, cb) {
57
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
58
+ nodbUtil.assert(Array.isArray(docs), 'NJS-005', 1);
59
+
60
+ if (docs.length == 0) {
61
+ cb(new Error(nodbUtil.getErrorMessage('NJS-005', 1)));
62
+ return;
63
+ }
64
+
65
+ let actualDocs = Array(docs.length);
66
+ for (let i = 0; i < docs.length; i++) {
67
+ let content = docs[i];
68
+ if (!nodbUtil.isSodaDocument(content)) {
69
+ content = Buffer.from(JSON.stringify(content));
70
+ }
71
+ actualDocs[i] = content;
72
+ }
73
+
74
+ this._insertManyAndGet(actualDocs, cb);
75
+ }
46
76
 
47
77
  // To insert a given document to the current collection
48
78
  function insertOne(content, cb) {
49
- var self = this;
50
-
51
- nodbUtil.assert(arguments.length === 2, 'NJS-009');
79
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
52
80
  nodbUtil.assert(nodbUtil.isObject(content) ||
53
- nodbUtil.isSodaDocument(content), 'NJS-006', 1);
54
- nodbUtil.assert(typeof cb === 'function', 'NJS-006', 2);
81
+ nodbUtil.isSodaDocument(content), 'NJS-005', 1);
55
82
 
56
83
  if (!nodbUtil.isSodaDocument(content)) {
57
84
  content = Buffer.from(JSON.stringify(content));
58
85
  }
59
86
 
60
- self._insertOne(content, cb);
87
+ this._insertOne(content, cb);
61
88
  }
62
89
 
63
- insertOnePromisified = nodbUtil.promisify(insertOne);
64
-
65
90
 
66
91
  // To insert a given document into the current collection and return the
67
92
  // metadata of the new document (result-document)
68
93
  function insertOneAndGet(content, cb) {
69
- var self = this;
70
-
71
- nodbUtil.assert(arguments.length === 2, 'NJS-009');
94
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
72
95
  nodbUtil.assert(nodbUtil.isObject(content) ||
73
- nodbUtil.isSodaDocument(content), 'NJS-006', 1);
74
- nodbUtil.assert(typeof cb === 'function', 'NJS-006', 2);
96
+ nodbUtil.isSodaDocument(content), 'NJS-005', 1);
75
97
 
76
98
  if (!nodbUtil.isSodaDocument(content)) {
77
99
  content = Buffer.from(JSON.stringify(content));
78
100
  }
79
101
 
80
- self._insertOneAndGet(content, function(err, doc) {
81
- if (doc) {
82
- sodaDocument.extend(doc);
83
- }
84
- cb(err, doc);
85
- });
102
+ this._insertOneAndGet(content, cb);
86
103
  }
87
104
 
88
- insertOneAndGetPromisified = nodbUtil.promisify(insertOneAndGet);
89
-
90
105
 
91
106
  // To create an index on documens
92
107
  function createIndex(spec, cb) {
93
- var self = this;
94
-
95
- nodbUtil.assert(arguments.length === 2, 'NJS-009', 1);
96
- nodbUtil.assert(nodbUtil.isObject(spec), 'NJS-006', 1);
97
- nodbUtil.assert(typeof cb === 'function', 'NJS-006', 2);
108
+ nodbUtil.checkAsyncArgs(arguments, 2, 2);
109
+ nodbUtil.assert(nodbUtil.isObject(spec), 'NJS-005', 1);
98
110
 
99
- self._createIndex(JSON.stringify(spec), cb);
111
+ this._createIndex(JSON.stringify(spec), cb);
100
112
  }
101
113
 
102
- createIndexPromisified = nodbUtil.promisify(createIndex);
103
-
104
114
 
105
115
  // To drop an index from document-collection
106
116
  function dropIndex(indexName, a2, a3) {
107
- var self = this;
108
- var options = {};
109
- var dropIndexCb;
117
+ let options = {};
118
+ let dropIndexCb;
110
119
 
111
- nodbUtil.assert(arguments.length >= 2 && arguments.length <= 3, 'NJS-009');
112
- nodbUtil.assert(typeof indexName === 'string', 'NJS-006', 1);
120
+ nodbUtil.checkAsyncArgs(arguments, 2, 3);
121
+ nodbUtil.assert(typeof indexName === 'string', 'NJS-005', 1);
113
122
 
114
123
  switch (arguments.length) {
115
124
  case 2:
116
- nodbUtil.assert(typeof a2 === 'function', 'NJS-006', 2);
117
125
  dropIndexCb = a2;
118
126
  break;
119
127
  case 3:
120
- nodbUtil.assert(typeof a2 === 'object', 'NJS-006', 2);
121
- nodbUtil.assert(typeof a3 === 'function', 'NJS-006', 3);
128
+ nodbUtil.assert(typeof a2 === 'object', 'NJS-005', 2);
122
129
  options = a2;
123
130
  dropIndexCb = a3;
124
131
  break;
125
132
  }
126
133
 
127
- self._dropIndex(indexName, options, dropIndexCb);
134
+ this._dropIndex(indexName, options, dropIndexCb);
128
135
  }
129
136
 
130
- dropIndexPromisified = nodbUtil.promisify(dropIndex);
131
-
132
137
 
133
138
  // To obtain the dataGuide of the document collection
134
139
  function getDataGuide(cb) {
135
- var self = this;
136
-
137
- nodbUtil.assert(typeof cb === 'function', 'NJS-009');
138
-
139
- self._getDataGuide(function(err, doc) {
140
- if (doc) {
141
- sodaDocument.extend(doc);
142
- }
143
- cb(err, doc);
144
- });
140
+ nodbUtil.checkAsyncArgs(arguments, 1, 1);
141
+ this._getDataGuide(cb);
145
142
  }
146
143
 
147
- getDataGuidePromisified = nodbUtil.promisify(getDataGuide);
148
144
 
145
+ class SodaCollection {
149
146
 
150
- // Creates an instance of sodaOperation object which supports
151
- // terminal/non-terminal functions for find operation.
152
- function find() {
153
- var self = this;
154
-
155
- var op = self._find();
156
- sodaOperation.extend(op, self._oracledb);
147
+ _extend(oracledb) {
148
+ this.createIndex = nodbUtil.promisify(oracledb, createIndex);
149
+ this.drop = nodbUtil.promisify(oracledb, drop);
150
+ this.dropIndex = nodbUtil.promisify(oracledb, dropIndex);
151
+ this.getDataGuide = nodbUtil.promisify(oracledb, getDataGuide);
152
+ this.insertMany = nodbUtil.promisify(oracledb, insertMany);
153
+ this.insertManyAndGet = nodbUtil.promisify(oracledb, insertManyAndGet);
154
+ this.insertOne = nodbUtil.promisify(oracledb, insertOne);
155
+ this.insertOneAndGet = nodbUtil.promisify(oracledb, insertOneAndGet);
156
+ }
157
157
 
158
- return op;
159
- }
158
+ find() {
159
+ nodbUtil.checkArgCount(arguments, 0, 0 );
160
+ return this._find();
161
+ }
160
162
 
163
+ get metaData() {
164
+ return JSON.parse(this._metaData);
165
+ }
161
166
 
162
- // The extend method is used to extend the collection instance from C Layer
163
- // with custom properties and method overrides. References to the original
164
- // methods are maintained so they can be invoked by the overriding method at
165
- // the right time
166
- function extend(coll, oracledb) {
167
- // Using Object.defineProperties to add properties to the soda instance with
168
- // special properties.
169
- Object.defineProperties (
170
- coll,
171
- {
172
- _oracledb: {
173
- value: oracledb
174
- },
175
- _drop: {
176
- value: coll.drop
177
- },
178
- drop: {
179
- value: dropCollectionPromisified,
180
- enumerable: true,
181
- writable: true
182
- },
183
- _insertOne: {
184
- value: coll.insertOne
185
- },
186
- insertOne: {
187
- value: insertOnePromisified,
188
- enumerable: true,
189
- writable: true
190
- },
191
- _insertOneAndGet: {
192
- value: coll.insertOneAndGet
193
- },
194
- insertOneAndGet: {
195
- value: insertOneAndGetPromisified,
196
- enumerable: true,
197
- writable: true
198
- },
199
- _createIndex: {
200
- value: coll.createIndex
201
- },
202
- createIndex: {
203
- value: createIndexPromisified,
204
- enumerable: true,
205
- writable: true
206
- },
207
- _dropIndex : {
208
- value: coll.dropIndex
209
- },
210
- dropIndex: {
211
- value: dropIndexPromisified,
212
- enumerable: true,
213
- writable: true
214
- },
215
- _getDataGuide: {
216
- value: coll.getDataGuide
217
- },
218
- getDataGuide: {
219
- value: getDataGuidePromisified,
220
- enumerable: true,
221
- writable: true
222
- },
223
- _find: {
224
- value: coll.find
225
- },
226
- find: {
227
- value: find,
228
- enumerable: true,
229
- writable: true
230
- }
231
- }
232
- );
233
167
  }
234
168
 
235
- module.exports.extend = extend;
169
+ module.exports = SodaCollection;