Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('13.3.1 should use oracledb.fetchArraySize for fetching', function (done) {
var defaultFetchArraySize;
var testFetchArraySize = 9;
defaultFetchArraySize = oracledb.fetchArraySize;
oracledb.fetchArraySize = testFetchArraySize;
var stream = connection.queryStream('SELECT employee_name FROM nodb_stream1 ORDER BY employee_name');
stream.on('data', function () {
stream.pause();
// Using the internal/private caches to validate
should.equal(stream._resultSet._rowCache.length, testFetchArraySize - (1 + stream._readableState.buffer.length));
// Using internal close method for Node.js versions < 8
stream._close(function() {
oracledb.fetchArraySize = defaultFetchArraySize;
done();
});
});
stream.on('end', function () {
it('58.1.6 fetchArraySize', function() {
var t = oracledb.fetchArraySize;
oracledb.fetchArraySize = t + 1;
t.should.eql(defaultValues.fetchArraySize);
(oracledb.fetchArraySize).should.eql(defaultValues.fetchArraySize + 1);
});
it('58.1.6 fetchArraySize', function() {
var t = oracledb.fetchArraySize;
oracledb.fetchArraySize = t + 1;
t.should.eql(defaultValues.fetchArraySize);
(oracledb.fetchArraySize).should.eql(defaultValues.fetchArraySize + 1);
});
var fun_query_out = function(affectFromId, maxArraySizeVal, fetchArraySizeVal, cb) {
oracledb.fetchArraySize = fetchArraySizeVal;
connection.execute(
"BEGIN :output := nodb_ref_fun_pkg.array_out(:c); END;",
{
c: { type: oracledb.NUMBER, dir: oracledb.BIND_IN, val: affectFromId },
output: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT, maxArraySize: maxArraySizeVal }
},
function(err, result) {
should.not.exist(err);
should.strictEqual(result.outBinds.output.length, tableSize - affectFromId);
fun_verifyResult_out(result.outBinds.output, affectFromId);
cb();
}
);
};
describe("151. fetchArraySize4.js", function() {
var connection = null;
var default_fetcArraySize = oracledb.fetchArraySize;
var default_maxRows = oracledb.maxRows;
var tableName = "nodb_fetchArraySize_151";
var tableSize = 1000;
var create_table = "BEGIN \n" +
" DECLARE \n" +
" e_table_missing EXCEPTION; \n" +
" PRAGMA EXCEPTION_INIT(e_table_missing, -00942); \n" +
" BEGIN \n" +
" EXECUTE IMMEDIATE('DROP TABLE " + tableName + " PURGE'); \n" +
" EXCEPTION \n" +
" WHEN e_table_missing \n" +
" THEN NULL; \n" +
" END; \n" +
" EXECUTE IMMEDIATE (' \n" +
" CREATE TABLE " + tableName + " ( \n" +
function(err, result) {
should.not.exist(err);
should.strictEqual(oracledb.fetchArraySize, 100);
should.strictEqual(result.rows[0][0], "fetchArraySize");
cb();
}
);
describe("150. fetchArraySize3.js", function() {
var connection = null;
var default_fetcArraySize = oracledb.fetchArraySize;
var default_maxRows = oracledb.maxRows;
var tableName = "nodb_fetchArraySize_150";
var tableSize = 1000;
var create_table = "BEGIN \n" +
" DECLARE \n" +
" e_table_missing EXCEPTION; \n" +
" PRAGMA EXCEPTION_INIT(e_table_missing, -00942); \n" +
" BEGIN \n" +
" EXECUTE IMMEDIATE('DROP TABLE " + tableName + " PURGE'); \n" +
" EXCEPTION \n" +
" WHEN e_table_missing \n" +
" THEN NULL; \n" +
" END; \n" +
" EXECUTE IMMEDIATE (' \n" +
" CREATE TABLE " + tableName + " ( \n" +
afterEach(function(done) {
oracledb.fetchArraySize = default_fetcArraySize;
oracledb.maxRows = default_maxRows;
done();
});
after('restore the values', function() {
oracledb.poolMin = defaultValues.poolMin;
oracledb.poolMax = defaultValues.poolMax;
oracledb.poolIncrement = defaultValues.poolIncrement;
oracledb.poolTimeout = defaultValues.poolTimeout;
oracledb.maxRows = defaultValues.maxRows;
oracledb.fetchArraySize = defaultValues.fetchArraySize;
oracledb.autoCommit = defaultValues.autoCommit;
oracledb.connectionClass = defaultValues.connectionClass;
oracledb.externalAuth = defaultValues.externalAuth;
oracledb.fetchAsString = defaultValues.fetchAsString;
oracledb.outFormat = defaultValues.outFormat;
oracledb.lobPrefetchSize = defaultValues.lobPrefetchSize;
oracledb.queueTimeout = defaultValues.queueTimeout;
oracledb.stmtCacheSize = defaultValues.stmtCacheSize;
oracledb.poolPingInterval = defaultValues.poolPingInterval;
oracledb.fetchAsBuffer = defaultValues.fetchAsBuffer;
oracledb.edition = defaultValues.edition;
oracledb.events = defaultValues.events;
});
describe("148. fetchArraySize1.js", function() {
var connection = null;
var defaultVal = oracledb.fetchArraySize;
before(function(done) {
oracledb.getConnection(dbConfig, function(err, conn) {
should.strictEqual(defaultVal, 100);
should.not.exist(err);
connection = conn;
done();
});
});
after(function(done) {
connection.close(function(err) {
should.not.exist(err);
done();
});
});