simple-oracledb
Advanced tools
Comparing version 0.0.36 to 0.1.1
@@ -92,3 +92,3 @@ ## Classes | ||
| [options] | <code>object</code> | | Optional execute options | | ||
| [options.streamResults] | <code>object</code> | | True to enable to stream the results in bulks, each bulk will invoke the provided callback (last callback invocation will have empty results) | | ||
| [options.splitResults] | <code>object</code> | | True to enable to split the results into bulks, each bulk will invoke the provided callback (last callback invocation will have empty results) | | ||
| [options.bulkRowsAmount] | <code>number</code> | <code>100</code> | The amount of rows to fetch (for streaming, thats the max rows that the callback will get for each streaming invocation) | | ||
@@ -109,6 +109,6 @@ | callback | <code>[AsyncCallback](#AsyncCallback)</code> | | Invoked with an error or the query results object holding all data including LOBs | | ||
//read all rows in bulks (streaming results) | ||
//read all rows in bulks (split results) | ||
connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
streamResults: true, | ||
bulkRowsAmount: 100 //The amount of rows to fetch (for streaming, thats the max rows that the callback will get for each streaming invocation) | ||
splitResults: true, | ||
bulkRowsAmount: 100 //The amount of rows to fetch (for splitting results, that is the max rows that the callback will get for each callback invocation) | ||
}, function onResults(error, results) { | ||
@@ -579,4 +579,4 @@ if (error) { | ||
* [#readAllRows(columnNames, resultSet, options, callback, [jsRowsBuffer])](#ResultSetReader+readAllRows) ℗ | ||
* [#read(columnNames, resultSet, options, callback)](#ResultSetReader+read) | ||
* [#stream(columnNames, resultSet, options, callback)](#ResultSetReader+stream) | ||
* [#readFully(columnNames, resultSet, options, callback)](#ResultSetReader+readFully) | ||
* [#readBulks(columnNames, resultSet, options, callback)](#ResultSetReader+readBulks) | ||
@@ -615,4 +615,4 @@ <a name="new_ResultSetReader_new"></a> | ||
<a name="ResultSetReader+read"></a> | ||
### ResultSetReader#read(columnNames, resultSet, options, callback) | ||
<a name="ResultSetReader+readFully"></a> | ||
### ResultSetReader#readFully(columnNames, resultSet, options, callback) | ||
Reads all data from the provided oracle ResultSet object. | ||
@@ -629,5 +629,5 @@ | ||
<a name="ResultSetReader+stream"></a> | ||
### ResultSetReader#stream(columnNames, resultSet, options, callback) | ||
Streams all data from the provided oracle ResultSet object to the callback in bulks.<br> | ||
<a name="ResultSetReader+readBulks"></a> | ||
### ResultSetReader#readBulks(columnNames, resultSet, options, callback) | ||
Reads all data from the provided oracle ResultSet object to the callback in bulks.<br> | ||
The last callback call will have an empty result. | ||
@@ -634,0 +634,0 @@ |
@@ -57,3 +57,3 @@ 'use strict'; | ||
* @param {object} [options] - Optional execute options | ||
* @param {object} [options.streamResults] - True to enable to stream the results in bulks, each bulk will invoke the provided callback (last callback invocation will have empty results) | ||
* @param {object} [options.splitResults] - True to enable to split the results into bulks, each bulk will invoke the provided callback (last callback invocation will have empty results) | ||
* @param {number} [options.bulkRowsAmount=100] - The amount of rows to fetch (for streaming, thats the max rows that the callback will get for each streaming invocation) | ||
@@ -73,6 +73,6 @@ * @param {AsyncCallback} callback - Invoked with an error or the query results object holding all data including LOBs | ||
* | ||
* //read all rows in bulks (streaming results) | ||
* //read all rows in bulks (split results) | ||
* connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
* streamResults: true, | ||
* bulkRowsAmount: 100 //The amount of rows to fetch (for streaming, thats the max rows that the callback will get for each streaming invocation) | ||
* splitResults: true, | ||
* bulkRowsAmount: 100 //The amount of rows to fetch (for splitting results, that is the max rows that the callback will get for each callback invocation) | ||
* }, function onResults(error, results) { | ||
@@ -97,7 +97,7 @@ * if (error) { | ||
var options = argumentsArray[argumentsArray.length - 1]; | ||
var streamResults = false; | ||
var splitResults = false; | ||
if (typeof options === 'object') { | ||
streamResults = options.streamResults; | ||
splitResults = options.splitResults; | ||
if (streamResults) { | ||
if (splitResults) { | ||
options.resultSet = true; | ||
@@ -111,6 +111,6 @@ } | ||
} else if (results.resultSet) { | ||
if (streamResults) { | ||
resultSetReader.stream(results.metaData, results.resultSet, options, callback); | ||
if (splitResults) { | ||
resultSetReader.readBulks(results.metaData, results.resultSet, options, callback); | ||
} else { | ||
resultSetReader.read(results.metaData, results.resultSet, options, callback); | ||
resultSetReader.readFully(results.metaData, results.resultSet, options, callback); | ||
} | ||
@@ -117,0 +117,0 @@ } else { |
@@ -72,3 +72,3 @@ 'use strict'; | ||
Array.prototype.push.apply(jsRowsBuffer, jsRows); | ||
} else { //stream results | ||
} else { //split results | ||
callback(null, jsRows); | ||
@@ -98,3 +98,3 @@ } | ||
*/ | ||
ResultSetReader.prototype.read = function (columnNames, resultSet, options, callback) { | ||
ResultSetReader.prototype.readFully = function (columnNames, resultSet, options, callback) { | ||
this.readAllRows(columnNames, resultSet, options, callback, []); | ||
@@ -104,3 +104,3 @@ }; | ||
/** | ||
* Streams all data from the provided oracle ResultSet object to the callback in bulks.<br> | ||
* Reads all data from the provided oracle ResultSet object to the callback in bulks.<br> | ||
* The last callback call will have an empty result. | ||
@@ -116,3 +116,3 @@ * | ||
*/ | ||
ResultSetReader.prototype.stream = function (columnNames, resultSet, options, callback) { | ||
ResultSetReader.prototype.readBulks = function (columnNames, resultSet, options, callback) { | ||
this.readAllRows(columnNames, resultSet, options, callback); | ||
@@ -119,0 +119,0 @@ }; |
{ | ||
"name": "simple-oracledb", | ||
"version": "0.0.36", | ||
"version": "0.1.1", | ||
"description": "Extend capabilities of oracledb with simplified API for quicker development.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -183,3 +183,3 @@ # simple-oracledb | ||
In order to tream the results in bulks, you can provide the streamResults = true option.<br> | ||
In order to split results into bulks, you can provide the splitResults = true option.<br> | ||
The callback will be called for each bulk with array of objects.<br> | ||
@@ -190,4 +190,4 @@ Once all rows are read, the callback will be called with an empty array. | ||
connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
streamResults: true, | ||
bulkRowsAmount: 100 //The amount of rows to fetch (for streaming, thats the max rows that the callback will get for each streaming invocation) | ||
splitResults: true, //True to enable to split the results into bulks, each bulk will invoke the provided callback (last callback invocation will have empty results) | ||
bulkRowsAmount: 100 //The amount of rows to fetch (for splitting results, that is the max rows that the callback will get for each callback invocation) | ||
}, function onResults(error, results) { | ||
@@ -374,5 +374,6 @@ if (error) { | ||
| ----------- | ------- | ----------- | | ||
| 2015-12-21 | v0.1.1 | Rename streamResults to splitResults | | ||
| 2015-12-21 | v0.0.36 | Maintenance | | ||
| 2015-12-21 | v0.0.35 | New bulkRowsAmount option to manage query resultset behaviour | | ||
| 2015-12-21 | v0.0.34 | Added streaming of query results with new option streamResults=true | | ||
| 2015-12-21 | v0.0.34 | Added splitting of query results into bulks with new option splitResults=true | | ||
| 2015-12-17 | v0.0.33 | Maintenance | | ||
@@ -379,0 +380,0 @@ | 2015-12-08 | v0.0.24 | Added pool.getConnection connection validation via running SQL test command | |
@@ -258,3 +258,3 @@ 'use strict'; | ||
it('resultset - stream', function (done) { | ||
it('resultset - split', function (done) { | ||
var table = 'TEST_ORA5'; | ||
@@ -280,3 +280,3 @@ initDB(table, [ | ||
resultSet: true, | ||
streamResults: true | ||
splitResults: true | ||
}, function (error, jsRows) { | ||
@@ -304,3 +304,3 @@ assert.isNull(error); | ||
], jsRows); | ||
} else { //end of stream | ||
} else { //end of bulks | ||
end(done, connection); | ||
@@ -307,0 +307,0 @@ } |
@@ -136,3 +136,3 @@ 'use strict'; | ||
connection.query(1, 2, 'a', { | ||
streamResults: true | ||
splitResults: true | ||
}, function (error, jsRows) { | ||
@@ -438,3 +438,3 @@ assert.isNull(error); | ||
connection.query(1, 2, 3, { | ||
streamResults: true, | ||
splitResults: true, | ||
}, function (error, jsRows) { | ||
@@ -441,0 +441,0 @@ assert.isNull(error); |
@@ -134,5 +134,5 @@ 'use strict'; | ||
describe('read tests', function () { | ||
describe('readFully tests', function () { | ||
it('empty', function (done) { | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -177,3 +177,3 @@ assert.equal(number, 100); | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -269,3 +269,3 @@ assert.equal(number, 100); | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -341,3 +341,3 @@ assert.equal(number, 100); | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -408,3 +408,3 @@ assert.equal(number, 100); | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -429,3 +429,3 @@ assert.equal(number, 100); | ||
it('error getRows', function (done) { | ||
ResultSetReader.read(columnNames, { | ||
ResultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -445,5 +445,5 @@ assert.equal(number, 100); | ||
describe('stream tests', function () { | ||
describe('readBulks tests', function () { | ||
it('empty', function (done) { | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -521,3 +521,3 @@ assert.equal(number, 100); | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -625,3 +625,3 @@ assert.equal(number, 100); | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -677,3 +677,3 @@ assert.equal(number, 100); | ||
var counter = 0; | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -752,3 +752,3 @@ assert.equal(number, 100); | ||
var counter = 0; | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -779,3 +779,3 @@ assert.equal(number, 100); | ||
it('error getRows', function (done) { | ||
ResultSetReader.stream(columnNames, { | ||
ResultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -782,0 +782,0 @@ assert.equal(number, 100); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
313759
394