simple-oracledb
Advanced tools
Comparing version 1.1.36 to 1.1.37
| Date | Version | Description | | ||
| ----------- | ------- | ----------- | | ||
| 2016-10-17 | v1.1.36 | Maintenance | | ||
| 2016-10-19 | v1.1.37 | Maintenance | | ||
| 2016-10-07 | v1.1.26 | Added oracledb.run | | ||
@@ -5,0 +5,0 @@ | 2016-10-06 | v1.1.25 | Maintenance | |
@@ -25,2 +25,17 @@ 'use strict'; | ||
* @memberof! RowsReader | ||
* @private | ||
* @param {Array} columnNames - Array of strings holding the column names of the results | ||
* @param {object} [options] - Options holder | ||
* @param {number} [options.flattenStackEveryRows=20] - The amount of rows after which the JS stack is flattened, low number can result in performance impact, high number can result in stack overflow error | ||
* @returns {number} The rows count | ||
*/ | ||
RowsReader.prototype.getFlattenRowsCount = function (columnNames, options) { | ||
return options.flattenStackEveryRows || Math.max(1, Math.floor(100 / columnNames.length)); | ||
}; | ||
/** | ||
* Reads all data from the provided oracle records array. | ||
* | ||
* @function | ||
* @memberof! RowsReader | ||
* @public | ||
@@ -91,3 +106,3 @@ * @param {Array} columnNames - Array of strings holding the column names of the results | ||
options = options || {}; | ||
var flattenStackEveryRows = options.flattenStackEveryRows || 20; | ||
var flattenStackEveryRows = options.flattenStackEveryRows || Math.max(1, Math.floor(100 / columnNames.length)); | ||
@@ -94,0 +109,0 @@ if (rows && rows.length) { |
{ | ||
"name": "simple-oracledb", | ||
"version": "1.1.36", | ||
"version": "1.1.37", | ||
"description": "Extend capabilities of oracledb with simplified API for quicker development.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -916,3 +916,3 @@ # simple-oracledb | ||
| ----------- | ------- | ----------- | | ||
| 2016-10-17 | v1.1.36 | Maintenance | | ||
| 2016-10-19 | v1.1.37 | Maintenance | | ||
| 2016-10-07 | v1.1.26 | Added oracledb.run | | ||
@@ -919,0 +919,0 @@ | 2016-10-06 | v1.1.25 | Maintenance | |
@@ -11,2 +11,60 @@ 'use strict'; | ||
describe('RowsReader Tests', function () { | ||
describe('getFlattenRowsCount tests', function () { | ||
it('no flattenStackEveryRows value', function () { | ||
var count = RowsReader.getFlattenRowsCount(['test'], {}); | ||
assert.strictEqual(count, 100); | ||
}); | ||
it('flattenStackEveryRows value provided', function () { | ||
var count = RowsReader.getFlattenRowsCount(['test'], { | ||
flattenStackEveryRows: 5000 | ||
}); | ||
assert.strictEqual(count, 5000); | ||
}); | ||
it('lots of columns', function () { | ||
var columnNames = []; | ||
var index; | ||
for (index = 0; index < 6000; index++) { | ||
columnNames.push('test' + index); | ||
} | ||
var count = RowsReader.getFlattenRowsCount(columnNames, {}); | ||
assert.strictEqual(count, 1); | ||
}); | ||
it('fews columns', function () { | ||
var columnNames = []; | ||
var index; | ||
for (index = 0; index < 23; index++) { | ||
columnNames.push('test' + index); | ||
} | ||
var count = RowsReader.getFlattenRowsCount(columnNames, {}); | ||
assert.strictEqual(count, 4); | ||
}); | ||
it('exact check columns amount', function () { | ||
var columnNames = []; | ||
var index; | ||
for (index = 0; index < 100; index++) { | ||
columnNames.push('test' + index); | ||
} | ||
var count = RowsReader.getFlattenRowsCount(columnNames, {}); | ||
assert.strictEqual(count, 1); | ||
}); | ||
it('almost exact check columns amount', function () { | ||
var columnNames = []; | ||
var index; | ||
for (index = 0; index < 99; index++) { | ||
columnNames.push('test' + index); | ||
} | ||
var count = RowsReader.getFlattenRowsCount(columnNames, {}); | ||
assert.strictEqual(count, 1); | ||
}); | ||
}); | ||
describe('read tests', function () { | ||
@@ -13,0 +71,0 @@ it('empty', function (done) { |
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
768901
16170