Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('19.3 testing maxRows setttings and queryStream() to fetch as string', function() {
var tableName = "nodb_timestamp3";
var inData = assist.TIMESTAMP_TZ_STRINGS_1;
var defaultLimit = oracledb.maxRows;
before(function(done) {
should.strictEqual(defaultLimit, 0);
assist.setUp4sql(connection, tableName, inData, done);
});
after(function(done) {
oracledb.fetchAsString = [];
connection.execute(
"DROP table " + tableName + " PURGE",
function(err) {
should.not.exist(err);
done();
}
);
}); // after
it('88.1.13 works with setting oracledb.maxRows > actual number of rows in the table', function(done) {
var id_1 = insertID++;
var specialStr_1 = '88.1.13_1';
var contentLength_1 = 200;
var strBuf_1 = random.getRandomString(contentLength_1, specialStr_1);
var content_1 = Buffer.from(strBuf_1, "utf-8");
var id_2 = insertID++;
var specialStr_2 = '88.1.13_2';
var contentLength_2 = 100;
var strBuf_2 = random.getRandomString(contentLength_2, specialStr_2);
var content_2 = Buffer.from(strBuf_2, "utf-8");
var maxRowsBak = oracledb.maxRows;
oracledb.maxRows = 10;
async.series([
function(cb) {
insertIntoBlobTable1(id_1, content_1, cb);
},
function(cb) {
insertIntoBlobTable1(id_2, content_2, cb);
},
function(cb) {
connection.execute(
"SELECT ID, B from nodb_blob1 WHERE id = " + id_1 + " or id = " +id_2,
{ },
{
fetchInfo : { B : { type : oracledb.BUFFER } }
},
it('87.5.15 works with setting oracledb.maxRows > actual number of rows in the table', function(done) {
var id_1 = insertID++;
var specialStr_1 = '87.5.15_1';
var contentLength_1 = 200;
var strBuf_1 = random.getRandomString(contentLength_1, specialStr_1);
var content_1 = Buffer.from(strBuf_1, "utf-8");
var id_2 = insertID++;
var specialStr_2 = '87.5.15_2';
var contentLength_2 = 100;
var strBuf_2 = random.getRandomString(contentLength_2, specialStr_2);
var content_2 = Buffer.from(strBuf_2, "utf-8");
var maxRowsBak = oracledb.maxRows;
oracledb.maxRows = 10;
async.series([
function(cb) {
insertIntoBlobTable1(id_1, content_1, cb);
},
function(cb) {
insertIntoBlobTable1(id_2, content_2, cb);
},
function(cb) {
var rowNumFetched = 2;
connection.execute(
"SELECT ID, B from nodb_blob1 WHERE id = " + id_1 + " or id = " +id_2,
{ },
{
outFormat : oracledb.OUT_FORMAT_ARRAY,
resultSet : true
it('59.2.3 works with oracledb.maxRows = actual number of rows fetched', function(done) {
var maxRowsBak = oracledb.maxRows;
oracledb.maxRows = 3;
var id_1 = insertID++;
var id_2 = insertID++;
var id_3 = insertID++;
async.series([
function(callback) {
streamIntoBlob(id_1, callback);
},
function(callback) {
streamIntoBlob(id_2, callback);
},
function(callback) {
streamIntoBlob(id_3, callback);
},
function(callback) {
connection.execute(
before('save the default values', function() {
defaultValues.poolMin = oracledb.poolMin;
defaultValues.poolMax = oracledb.poolMax;
defaultValues.poolIncrement = oracledb.poolIncrement;
defaultValues.poolTimeout = oracledb.poolTimeout;
defaultValues.maxRows = oracledb.maxRows;
defaultValues.fetchArraySize = oracledb.fetchArraySize;
defaultValues.autoCommit = oracledb.autoCommit;
defaultValues.connectionClass = oracledb.connectionClass;
defaultValues.externalAuth = oracledb.externalAuth;
defaultValues.fetchAsString = oracledb.fetchAsString;
defaultValues.outFormat = oracledb.outFormat;
defaultValues.lobPrefetchSize = oracledb.lobPrefetchSize;
defaultValues.queueTimeout = oracledb.queueTimeout;
defaultValues.stmtCacheSize = oracledb.stmtCacheSize;
defaultValues.poolPingInterval = oracledb.poolPingInterval;
defaultValues.fetchAsBuffer = oracledb.fetchAsBuffer;
defaultValues.edition = oracledb.edition;
defaultValues.events = oracledb.events;
});
describe("149. fetchArraySize2.js", function() {
var connection = null;
var default_fetcArraySize = oracledb.fetchArraySize;
var default_maxRows = oracledb.maxRows;
var tableName = "nodb_fetchArraySize_149";
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" +
" id NUMBER, \n" +
function(err, result) {
should.not.exist(err);
rowExpected = (oracledb.maxRows >= 2) ? 2 : oracledb.maxRows;
if(rsFlag === true) {
rowExpected = 2;
}
should.strictEqual(result.rows.length, rowExpected);
rowid_1 = result.rows[0][1];
if(rowExpected === 2) {
rowid_2 = result.rows[1][1];
}
cb();
}
);
function(err, row) {
should.not.exist(err);
should.strictEqual(row.length, 2);
var resultVal = row[0][1];
compareClientFetchResult(err, resultVal, specialStr_1, content_1, contentLength_1);
resultVal = row[1][1];
compareClientFetchResult(err, resultVal, specialStr_2, content_2, contentLength_2);
oracledb.maxRows =maxRowsBak;
result.resultSet.close(function(err) {
should.not.exist(err);
cb();
});
}
);
function(err, result) {
should.not.exist(err);
var rowExpected = (oracledb.maxRows >= numRows) ? numRows : oracledb.maxRows;
should.strictEqual(result.rows.length, rowExpected);
callback();
}
);
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" +
" id NUMBER, \n" +