simple-oracledb
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -51,3 +51,3 @@ ## Classes | ||
* [#execute(sql, [bindParams], [options], callback)](#Connection+execute) | ||
* [#query(sql, [bindParams], [options], callback)](#Connection+query) | ||
* [#query(sql, [bindParams], [options], [callback])](#Connection+query) ⇒ <code>[ResultSetReadStream](#ResultSetReadStream)</code> | ||
* [#insert(sql, bindParams, options, callback)](#Connection+insert) | ||
@@ -99,3 +99,3 @@ * [#update(sql, bindParams, options, callback)](#Connection+update) | ||
<a name="Connection+query"></a> | ||
### Connection#query(sql, [bindParams], [options], callback) | ||
### Connection#query(sql, [bindParams], [options], [callback]) ⇒ <code>[ResultSetReadStream](#ResultSetReadStream)</code> | ||
Provides simpler interface than the original oracledb connection.execute function to enable simple query invocation.<br> | ||
@@ -107,2 +107,3 @@ The callback output will be an array of objects, each object holding a property for each field with the actual value.<br> | ||
**Returns**: <code>[ResultSetReadStream](#ResultSetReadStream)</code> - The stream to read the results from (if streamResults=true in options) | ||
**Access:** public | ||
@@ -118,3 +119,3 @@ | ||
| [options.bulkRowsAmount] | <code>number</code> | <code>100</code> | The amount of rows to fetch (for splitting results, that is the max rows that the callback will get for each callback invocation) | | ||
| callback | <code>[AsyncCallback](#AsyncCallback)</code> | | Invoked with an error or the query results object holding all data including LOBs | | ||
| [callback] | <code>[AsyncCallback](#AsyncCallback)</code> | | Invoked with an error or the query results object holding all data including LOBs (optional if streamResults=true) | | ||
@@ -148,15 +149,10 @@ **Example** | ||
//stream all rows (options.streamResults) | ||
connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
//if callback is provided, the stream is provided in the result as well | ||
var stream = connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
streamResults: true | ||
}, function onResults(error, stream) { | ||
if (error) { | ||
//handle error... | ||
} else { | ||
//listen to fetched rows via data event or just pipe to another handler | ||
stream.on('data', function (row) { | ||
//use row object | ||
}); | ||
}); | ||
//listen to other events such as end/close/error.... | ||
} | ||
//listen to fetched rows via data event or just pipe to another handler | ||
stream.on('data', function (row) { | ||
//use row object | ||
}); | ||
@@ -726,13 +722,20 @@ ``` | ||
* [ResultSetReadStream](#ResultSetReadStream) | ||
* [new ResultSetReadStream(next)](#new_ResultSetReadStream_new) | ||
* [new ResultSetReadStream()](#new_ResultSetReadStream_new) | ||
* [.nextRow.set(nextRow)](#ResultSetReadStream.nextRow.set) ℗ | ||
* [#_read()](#ResultSetReadStream+_read) ℗ | ||
* [.nextRow(streamCallback)](#ResultSetReadStream.nextRow) ℗ | ||
<a name="new_ResultSetReadStream_new"></a> | ||
### new ResultSetReadStream(next) | ||
### new ResultSetReadStream() | ||
A node.js read stream for resultsets. | ||
<a name="ResultSetReadStream.nextRow.set"></a> | ||
### ResultSetReadStream.nextRow.set(nextRow) ℗ | ||
Sets the nextRow value. | ||
**Access:** private | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| next | <code>function</code> | The read next row function | | ||
| nextRow | <code>function</code> | The next row callback function | | ||
@@ -744,2 +747,12 @@ <a name="ResultSetReadStream+_read"></a> | ||
**Access:** private | ||
<a name="ResultSetReadStream.nextRow"></a> | ||
### ResultSetReadStream.nextRow(streamCallback) ℗ | ||
Reads the next rows from the resultset and pushes via events. | ||
**Access:** private | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| streamCallback | <code>function</code> | The callback function | | ||
<a name="ResultSetReader"></a> | ||
@@ -757,3 +770,3 @@ ## ResultSetReader | ||
* [#readBulks(columnNames, resultSet, options, callback)](#ResultSetReader+readBulks) | ||
* [#stream(columnNames, resultSet, callback)](#ResultSetReader+stream) | ||
* [#stream(columnNames, resultSet, stream)](#ResultSetReader+stream) | ||
@@ -820,3 +833,3 @@ <a name="new_ResultSetReader_new"></a> | ||
<a name="ResultSetReader+stream"></a> | ||
### ResultSetReader#stream(columnNames, resultSet, callback) | ||
### ResultSetReader#stream(columnNames, resultSet, stream) | ||
Reads all data from the provided oracle ResultSet object to the callback in bulks.<br> | ||
@@ -831,3 +844,3 @@ The last callback call will have an empty result. | ||
| resultSet | <code>Array</code> | The oracle ResultSet object | | ||
| callback | <code>[AsyncCallback](#AsyncCallback)</code> | called for each read bulk of rows or in case of an error | | ||
| stream | <code>[ResultSetReadStream](#ResultSetReadStream)</code> | The stream used to read the results from | | ||
@@ -834,0 +847,0 @@ <a name="RowsReader"></a> |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var constants = require('./constants'); | ||
var ResultSetReadStream = require('./resultset-read-stream'); | ||
@@ -84,3 +85,4 @@ /*jslint debug: true */ | ||
* @param {number} [options.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) | ||
* @param {AsyncCallback} callback - Invoked with an error or the query results object holding all data including LOBs | ||
* @param {AsyncCallback} [callback] - Invoked with an error or the query results object holding all data including LOBs (optional if streamResults=true) | ||
* @returns {ResultSetReadStream} The stream to read the results from (if streamResults=true in options) | ||
* @example | ||
@@ -113,15 +115,10 @@ * ```js | ||
* //stream all rows (options.streamResults) | ||
* connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
* //if callback is provided, the stream is provided in the result as well | ||
* var stream = connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
* streamResults: true | ||
* }, function onResults(error, stream) { | ||
* if (error) { | ||
* //handle error... | ||
* } else { | ||
* //listen to fetched rows via data event or just pipe to another handler | ||
* stream.on('data', function (row) { | ||
* //use row object | ||
* }); | ||
* }); | ||
* | ||
* //listen to other events such as end/close/error.... | ||
* } | ||
* //listen to fetched rows via data event or just pipe to another handler | ||
* stream.on('data', function (row) { | ||
* //use row object | ||
* }); | ||
@@ -135,3 +132,6 @@ * ``` | ||
var callback = argumentsArray.pop(); | ||
var callback; | ||
if (typeof argumentsArray[argumentsArray.length - 1] === 'function') { //if last argument is callback | ||
callback = argumentsArray.pop(); | ||
} | ||
@@ -141,2 +141,3 @@ var options = argumentsArray[argumentsArray.length - 1]; | ||
var streamResults = false; | ||
var noCallback = false; | ||
if (typeof options === 'object') { | ||
@@ -148,8 +149,27 @@ splitResults = options.splitResults; | ||
options.resultSet = true; | ||
if (!callback) { | ||
if (streamResults) { | ||
noCallback = true; | ||
} else { | ||
throw new Error('Missing callback'); | ||
} | ||
} | ||
} | ||
} | ||
var output; | ||
if (streamResults) { | ||
output = new ResultSetReadStream(); | ||
} | ||
argumentsArray.push(function onExecute(error, results) { | ||
if (error || (!results)) { | ||
callback(error, results); | ||
if (noCallback) { | ||
output.nextRow = function emitError(streamCallback) { | ||
streamCallback(error || new Error('No Results')); | ||
}; | ||
} else { | ||
callback(error, results); | ||
} | ||
} else if (results.resultSet) { | ||
@@ -159,3 +179,7 @@ if (splitResults) { | ||
} else if (streamResults) { | ||
resultSetReader.stream(results.metaData, results.resultSet, callback); | ||
resultSetReader.stream(results.metaData, results.resultSet, output); | ||
if (callback) { | ||
callback(null, output); | ||
} | ||
} else { | ||
@@ -170,2 +194,4 @@ resultSetReader.readFully(results.metaData, results.resultSet, options, callback); | ||
self.execute.apply(self, argumentsArray); | ||
return output; | ||
}; | ||
@@ -172,0 +198,0 @@ |
@@ -13,10 +13,34 @@ 'use strict'; | ||
* @public | ||
* @param {function} next - The read next row function | ||
*/ | ||
function ResultSetReadStream(next) { | ||
Readable.call(this, { | ||
function ResultSetReadStream() { | ||
var self = this; | ||
Readable.call(self, { | ||
objectMode: true | ||
}); | ||
this.nextRow = next; | ||
Object.defineProperty(self, 'nextRow', { | ||
/** | ||
* Sets the nextRow value. | ||
* | ||
* @function | ||
* @memberof! ResultSetReadStream | ||
* @alias ResultSetReadStream.nextRow.set | ||
* @private | ||
* @param {function} nextRow - The next row callback function | ||
*/ | ||
set: function (nextRow) { | ||
self.next = nextRow; | ||
if (self.inRead) { | ||
/*jslint nomen: true */ | ||
/*eslint-disable no-underscore-dangle*/ | ||
//jscs:disable disallowDanglingUnderscores | ||
self._read(); | ||
//jscs:enable disallowDanglingUnderscores | ||
/*eslint-enable no-underscore-dangle*/ | ||
/*jslint nomen: false */ | ||
} | ||
} | ||
}); | ||
} | ||
@@ -39,13 +63,19 @@ | ||
self.nextRow(function onNextRowRead(error, data) { | ||
if (error) { | ||
self.emit('error', error); | ||
} else if (data && (data.length === 1)) { | ||
self.push(data[0]); | ||
} else if (data && (data.length > 1)) { | ||
self.emit('error', new Error('Expected 1 row, actual: ' + data.length)); | ||
} else { | ||
self.push(null); | ||
} | ||
}); | ||
self.inRead = false; | ||
if (self.next) { | ||
self.next(function onNextRowRead(error, data) { | ||
if (error) { | ||
self.emit('error', error); | ||
} else if (data && (data.length === 1)) { | ||
self.push(data[0]); | ||
} else if (data && (data.length > 1)) { | ||
self.emit('error', new Error('Expected 1 row, actual: ' + data.length)); | ||
} else { | ||
self.push(null); | ||
} | ||
}); | ||
} else { | ||
self.inRead = true; | ||
} | ||
}; | ||
@@ -52,0 +82,0 @@ //jscs:enable disallowDanglingUnderscores |
'use strict'; | ||
var rowsReader = require('./rows-reader'); | ||
var ResultSetReadStream = require('./resultset-read-stream'); | ||
@@ -127,5 +126,5 @@ /*jslint debug: true */ | ||
* @param {Array} resultSet - The oracle ResultSet object | ||
* @param {AsyncCallback} callback - called for each read bulk of rows or in case of an error | ||
* @param {ResultSetReadStream} stream - The stream used to read the results from | ||
*/ | ||
ResultSetReader.prototype.stream = function (columnNames, resultSet, callback) { | ||
ResultSetReader.prototype.stream = function (columnNames, resultSet, stream) { | ||
var self = this; | ||
@@ -138,9 +137,16 @@ | ||
//create new read stream | ||
var readStream = new ResultSetReadStream(function readNextRow(streamCallback) { | ||
/** | ||
* Reads the next rows from the resultset and pushes via events. | ||
* | ||
* @function | ||
* @memberof! ResultSetReadStream | ||
* @alias ResultSetReadStream.nextRow | ||
* @private | ||
* @param {function} streamCallback - The callback function | ||
*/ | ||
stream.nextRow = function readNextRow(streamCallback) { | ||
self.readNextRows(columnNames, resultSet, readOptions, streamCallback); | ||
}); | ||
callback(null, readStream); | ||
}; | ||
}; | ||
module.exports = new ResultSetReader(); |
{ | ||
"name": "simple-oracledb", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Extend capabilities of oracledb with simplified API for quicker development.", | ||
@@ -38,3 +38,3 @@ "author": { | ||
"dependencies": { | ||
"async": "^1.5.0" | ||
"async": "^1.5.1" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
@@ -210,16 +210,13 @@ # simple-oracledb | ||
//stream all rows (options.streamResults) | ||
connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
//if callback is provided, the stream is provided in the result as well | ||
var stream = connection.query('SELECT * FROM departments WHERE manager_id > :id', [110], { | ||
streamResults: true | ||
}, function onResults(error, stream) { | ||
if (error) { | ||
//handle error... | ||
} else { | ||
//listen to fetched rows via data event or just pipe to another handler | ||
stream.on('data', function (row) { | ||
//use row object | ||
}); | ||
}); | ||
//listen to other events such as end/close/error.... | ||
} | ||
//listen to fetched rows via data event or just pipe to another handler | ||
stream.on('data', function (row) { | ||
//use row object | ||
}); | ||
//listen to other events such as end/close/error.... | ||
``` | ||
@@ -463,2 +460,3 @@ | ||
| ----------- | ------- | ----------- | | ||
| 2016-01-07 | v0.1.7 | connection.query with streamResults=true returns a readable stream | | ||
| 2015-12-30 | v0.1.6 | connection.transaction disables commit/rollback while running | | ||
@@ -465,0 +463,0 @@ | 2015-12-29 | v0.1.5 | Maintenance | |
@@ -365,4 +365,53 @@ 'use strict'; | ||
it('resultset - stream no callback', function (done) { | ||
var table = 'TEST_ORA8'; | ||
var dbData = [ | ||
{ | ||
COL1: 'PK1', | ||
COL2: 2, | ||
COL3: 30, | ||
COL4: '123' | ||
}, | ||
{ | ||
COL1: 'PK2', | ||
COL2: 200, | ||
COL3: 30, | ||
COL4: 'SOME TEST HERE' | ||
}, | ||
{ | ||
COL1: 'PK3', | ||
COL2: 5000, | ||
COL3: 1, | ||
COL4: 'MORE DATA HERE!!!', | ||
LOB1: 'THIS IS SOME CLOB TEST TEXT', | ||
LOB2: new Buffer('BLOB - 123456') | ||
} | ||
]; | ||
initDB(table, dbData, function (pool) { | ||
pool.getConnection(function (err, connection) { | ||
assert.isUndefined(err); | ||
var stream = connection.query('SELECT * FROM ' + table, [], { | ||
streamResults: true | ||
}); | ||
var eventCounter = 0; | ||
stream.on('data', function (row) { | ||
assert.deepEqual(dbData[eventCounter], row); | ||
eventCounter++; | ||
}); | ||
stream.on('end', function () { | ||
assert.equal(eventCounter, dbData.length); | ||
end(done, connection); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('rows - lob data', function (done) { | ||
var table = 'TEST_ORA8'; | ||
var table = 'TEST_ORA9'; | ||
initDB(table, [ | ||
@@ -369,0 +418,0 @@ { |
@@ -17,7 +17,8 @@ 'use strict'; | ||
it('no data', function (done) { | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
process.nextTick(function () { | ||
callback(null, []); | ||
}); | ||
}); | ||
}; | ||
@@ -32,7 +33,8 @@ ['data', 'error', 'close'].forEach(function (eventName) { | ||
it('undefined data', function (done) { | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
process.nextTick(function () { | ||
callback(); | ||
}); | ||
}); | ||
}; | ||
@@ -47,7 +49,8 @@ ['data', 'error', 'close'].forEach(function (eventName) { | ||
it('null data', function (done) { | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
process.nextTick(function () { | ||
callback(); | ||
}); | ||
}); | ||
}; | ||
@@ -62,7 +65,8 @@ ['data', 'error', 'close'].forEach(function (eventName) { | ||
it('invalid data', function (done) { | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
process.nextTick(function () { | ||
callback(null, [{}, {}]); | ||
}); | ||
}); | ||
}; | ||
@@ -81,7 +85,8 @@ ['data', 'end', 'close'].forEach(function (eventName) { | ||
it('error on start', function (done) { | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
process.nextTick(function () { | ||
callback(new Error('test')); | ||
}); | ||
}); | ||
}; | ||
@@ -101,3 +106,4 @@ ['data', 'end', 'close'].forEach(function (eventName) { | ||
var counter = 0; | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
counter++; | ||
@@ -120,3 +126,3 @@ | ||
} | ||
}); | ||
}; | ||
@@ -140,3 +146,4 @@ ['end', 'close'].forEach(function (eventName) { | ||
var counter = 0; | ||
var stream = new ResultSetReadStream(function (callback) { | ||
var stream = new ResultSetReadStream(); | ||
stream.nextRow = function (callback) { | ||
counter++; | ||
@@ -159,3 +166,3 @@ | ||
} | ||
}); | ||
}; | ||
@@ -162,0 +169,0 @@ ['close', 'error'].forEach(function (eventName) { |
@@ -7,5 +7,6 @@ 'use strict'; | ||
var helper = require('../helpers/test-oracledb'); | ||
var ResultSetReader = require('../../lib/resultset-reader'); | ||
var resultSetReader = require('../../lib/resultset-reader'); | ||
var ResultSetReadStream = require('../../lib/resultset-read-stream'); | ||
describe('ResultSetReader Tests', function () { | ||
describe('resultSetReader Tests', function () { | ||
var columnNames = [ | ||
@@ -53,3 +54,3 @@ { | ||
ResultSetReader.readNextRows(columnNames, { | ||
resultSetReader.readNextRows(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -107,3 +108,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readNextRows(columnNames, { | ||
resultSetReader.readNextRows(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -139,3 +140,3 @@ assert.equal(number, 5); | ||
it('empty', function (done) { | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -180,3 +181,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -272,3 +273,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -344,3 +345,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -411,3 +412,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -432,3 +433,3 @@ assert.equal(number, 100); | ||
it('error getRows', function (done) { | ||
ResultSetReader.readFully(columnNames, { | ||
resultSetReader.readFully(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -450,3 +451,3 @@ assert.equal(number, 100); | ||
it('empty', function (done) { | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -524,3 +525,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -628,3 +629,3 @@ assert.equal(number, 100); | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -680,3 +681,3 @@ assert.equal(number, 100); | ||
var counter = 0; | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -755,3 +756,3 @@ assert.equal(number, 100); | ||
var counter = 0; | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -782,3 +783,3 @@ assert.equal(number, 100); | ||
it('error getRows', function (done) { | ||
ResultSetReader.readBulks(columnNames, { | ||
resultSetReader.readBulks(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -800,3 +801,5 @@ assert.equal(number, 100); | ||
it('empty', function (done) { | ||
ResultSetReader.stream(columnNames, { | ||
var stream = new ResultSetReadStream(); | ||
resultSetReader.stream(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -806,11 +809,9 @@ assert.equal(number, 1); | ||
} | ||
}, function (error, stream) { | ||
assert.isNull(error); | ||
}, stream); | ||
stream.on('data', function () { | ||
assert.fail(); | ||
}); | ||
stream.on('data', function () { | ||
assert.fail(); | ||
}); | ||
stream.on('end', done); | ||
}); | ||
stream.on('end', done); | ||
}); | ||
@@ -874,3 +875,4 @@ | ||
ResultSetReader.stream(columnNames, { | ||
var stream = new ResultSetReadStream(); | ||
resultSetReader.stream(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -886,16 +888,14 @@ assert.equal(number, 1); | ||
} | ||
}, function (error, stream) { | ||
assert.isNull(error); | ||
}, stream); | ||
var eventCounter = 0; | ||
stream.on('data', function (row) { | ||
assert.deepEqual(resultData[eventCounter], row); | ||
eventCounter++; | ||
}); | ||
var eventCounter = 0; | ||
stream.on('data', function (row) { | ||
assert.deepEqual(resultData[eventCounter], row); | ||
eventCounter++; | ||
}); | ||
stream.on('end', function () { | ||
assert.equal(eventCounter, resultData.length); | ||
stream.on('end', function () { | ||
assert.equal(eventCounter, resultData.length); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -954,3 +954,4 @@ }); | ||
ResultSetReader.stream(columnNames, { | ||
var stream = new ResultSetReadStream(); | ||
resultSetReader.stream(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -966,17 +967,15 @@ assert.equal(number, 1); | ||
} | ||
}, function (error, stream) { | ||
assert.isNull(error); | ||
}, stream); | ||
var eventCounter = 0; | ||
stream.on('data', function (row) { | ||
assert.deepEqual(resultData[eventCounter], row); | ||
eventCounter++; | ||
}); | ||
var eventCounter = 0; | ||
stream.on('data', function (row) { | ||
assert.deepEqual(resultData[eventCounter], row); | ||
eventCounter++; | ||
}); | ||
stream.on('error', function (streamError) { | ||
assert.equal(eventCounter, resultData.length); | ||
assert.equal(streamError.message, 'lob2 error'); | ||
stream.on('error', function (streamError) { | ||
assert.equal(eventCounter, resultData.length); | ||
assert.equal(streamError.message, 'lob2 error'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -986,3 +985,4 @@ }); | ||
it('error getRows', function (done) { | ||
ResultSetReader.stream(columnNames, { | ||
var stream = new ResultSetReadStream(); | ||
resultSetReader.stream(columnNames, { | ||
getRows: function (number, callback) { | ||
@@ -995,14 +995,12 @@ assert.equal(number, 1); | ||
} | ||
}, function (error, stream) { | ||
assert.isNull(error); | ||
}, stream); | ||
stream.on('error', function (streamError) { | ||
assert.equal(streamError.message, 'getrows'); | ||
stream.on('error', function (streamError) { | ||
assert.equal(streamError.message, 'getrows'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
stream.on('data', function () { | ||
assert.fail(); | ||
}); | ||
stream.on('data', function () { | ||
assert.fail(); | ||
}); | ||
@@ -1009,0 +1007,0 @@ }); |
Sorry, the diff of this file is too big to display
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
405790
8670
487
Updatedasync@^1.5.1