Minor code refactoring

This commit is contained in:
Sharad Chandran R 2023-08-17 19:27:09 +05:30
parent 4ce63afd3e
commit 45ef214400
12 changed files with 140 additions and 156 deletions

View File

@ -1266,7 +1266,7 @@ class Connection extends EventEmitter {
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
const inSubscr = _subscriptions.get(name);
let outValue = await this._impl.subscribe(inSubscr, options);
const outValue = await this._impl.subscribe(inSubscr, options);
let subscription;
if (options.namespace === constants.SUBSCR_NAMESPACE_DBCHANGE) {
subscription = outValue.subscription;

View File

@ -251,10 +251,12 @@ class DownHostsCache {
}
return cOpts;
}
/**
* Return if a desc is cached.
* A desc is cached if all the connection options(addresses)
* in that description are cached.
*/
isDownDescCached(desc) {
//const desc = this.descriptionList[d];
//let cOpts = new Array();
const cOpts = desc.getConnectOptions();
for (let i = 0; i < cOpts.length; i++) {
if (!this.isDownHostsCached(cOpts[i]))
@ -263,7 +265,7 @@ class DownHostsCache {
return true;
}
/**
* Reorder description list such that description with all connection options in downcache
* Reorder description list such that description with all connection options in downcache
* is pushed to the end of the description list
*/
reorderDescriptionList(descs) {
@ -273,12 +275,12 @@ class DownHostsCache {
while (topIdx < btmIdx) {
// increment topIdx if the address is not cached
// increment topIdx if the desc is not cached
while (topIdx <= btmIdx
&& !this.isDownDescCached(descs[topIdx]))
topIdx++;
// decrement btmIdx if address is cached
// decrement btmIdx if desc is cached
while (btmIdx >= topIdx
&& this.isDownDescCached(descs[btmIdx]))
btmIdx--;

View File

@ -27,7 +27,7 @@
*
* DESCRIPTION
* Test Oracle Advanced Queueing (AQ).
* The test cases are for subscribe callback function parameter message
* The test cases are for subscribe callback function parameter message
* to have msgId field
*
*****************************************************************************/
@ -68,7 +68,7 @@ describe('283.aq5.js', function() {
} else {
await testsUtil.createAQtestUser(AQ_USER, AQ_USER_PWD);
let credential = {
const credential = {
user: AQ_USER,
password: AQ_USER_PWD,
connectString: dbConfig.connectString
@ -95,7 +95,7 @@ describe('283.aq5.js', function() {
}
}); //before
after(async function () {
after(async function() {
if (!isRunnable) {
return;
} else {
@ -104,29 +104,29 @@ describe('283.aq5.js', function() {
}
});
it('283.1 subscribe dequeue messages', async() => {
const options = {
namespace: oracledb.SUBSCR_NAMESPACE_AQ,
callback: cbSubscribe,
timeout: 300
};
it('283.1 subscribe dequeue messages', async () => {
const options = {
namespace: oracledb.SUBSCR_NAMESPACE_AQ,
callback: cbSubscribe,
timeout: 300
};
await conn.subscribe(objQueueName, options);
await conn.subscribe(objQueueName, options);
// Enqueue
const queue1 = await conn.getQueue(objQueueName);
const messageString = 'This is my message';
await queue1.enqOne(messageString);
await conn.commit ();
// Enqueue
const queue1 = await conn.getQueue(objQueueName);
const messageString = 'This is my message';
await queue1.enqOne(messageString);
await conn.commit ();
// Dequeue
const queue2 = await conn.getQueue(objQueueName);
const msg = await queue2.deqOne ();
await conn.commit ();
assert(msg);
// Dequeue
const queue2 = await conn.getQueue(objQueueName);
const msg = await queue2.deqOne ();
await conn.commit ();
assert(msg);
await conn.unsubscribe(objQueueName);
await conn.unsubscribe(objQueueName);
});
});

View File

@ -499,7 +499,7 @@ describe('42. dataTypeRaw.js', function() {
assert.deepStrictEqual(result.rows[0][0], expected);
};
describe ('42.7 DB_TYPE_RAW in Advanced Queue (AQ)', function () {
describe('42.7 DB_TYPE_RAW in Advanced Queue (AQ)', function() {
let isRunnable = true;
let conn;
const AQ_USER = 'NODB_SCHEMA_AQTEST8';
@ -507,7 +507,7 @@ describe('42. dataTypeRaw.js', function() {
const rawQueueName = "NODB_RAW_QUEUE8";
const RAW_TABLE = "NODB_RAW_QUEUE_TAB";
before(async function () {
before(async function() {
if (!dbConfig.test.DBA_PRIVILEGE || oracledb.thin) {
isRunnable = false;
}
@ -541,7 +541,7 @@ describe('42. dataTypeRaw.js', function() {
}
}); //before
after (async function () {
after(async function() {
if (!isRunnable) {
return;
} else {
@ -550,9 +550,10 @@ describe('42. dataTypeRaw.js', function() {
}
}); // after
it('42.7.1 enqOne/deqOne with DB_TYPE_RAW specified', async() => {
it('42.7.1 enqOne/deqOne with DB_TYPE_RAW specified', async () => {
const queue1 = await conn.getQueue(rawQueueName,
{ payloadType: oracledb.DB_TYPE_RAW });
{ payloadType: oracledb.DB_TYPE_RAW }
);
const messageString = 'This is my message';
const msgBuf = Buffer.from(messageString, 'utf8');
await queue1.enqOne(msgBuf);
@ -570,10 +571,10 @@ describe('42. dataTypeRaw.js', function() {
{payloadType: oracledb.DB_TYPE_RAW});
const messages1 = [
"Message 1",
Buffer.from ("Message 2", "utf-8"),
Buffer.from ("Message 3", "utf-8"),
"Message 4"
];
Buffer.from ("Message 2", "utf-8"),
Buffer.from ("Message 3", "utf-8"),
"Message 4"
];
await queue1.enqMany(messages1);
await conn.commit ();

View File

@ -94,7 +94,7 @@ describe('259. tpc.js', function() {
});
it('259.2.1 test tpcBegin, tpcPrepare, tpcRollback', async function() {
let xid = {
const xid = {
formatId: 3900,
globalTransactionId: "txn3900",
branchQualifier: "branchId"
@ -114,7 +114,7 @@ describe('259. tpc.js', function() {
});
it('259.2.2 test tpcBegin, tpcPrepare, tpcCommit', async function() {
let xid = {
const xid = {
formatId: 3901,
globalTransactionId: "txn3901",
branchQualifier: "branchId"
@ -122,25 +122,24 @@ describe('259. tpc.js', function() {
await conn.tpcBegin(xid, oracledb.TPC_BEGIN_NEW, 60);
await conn.execute(
`INSERT INTO TBL_259_2 (IntCol, StringCol) values (1, 'testName')`);
let commitNeeded = await conn.tpcPrepare(xid);
const commitNeeded = await conn.tpcPrepare(xid);
assert.strictEqual(commitNeeded, true);
await conn.tpcCommit(xid, false);
let conn1;
conn1 = await oracledb.getConnection(dbConfig);
const conn1 = await oracledb.getConnection(dbConfig);
const result = await conn1.execute(`SELECT INTCOL FROM TBL_259_2`);
assert.strictEqual(result.rows[0][0], 1);
await conn1.close();
});
it('259.2.3 test multiple global transactions on same connection', async function() {
let xid1 = {
const xid1 = {
formatId: 3902,
globalTransactionId: "txn3902",
branchQualifier: "branch1"
};
let xid2 = {
const xid2 = {
formatId: 3902,
globalTransactionId: "txn3902",
branchQualifier: "branch2"
@ -156,8 +155,8 @@ describe('259. tpc.js', function() {
`INSERT INTO TBL_259_2 (IntCol, StringCol) VALUES (2, 'testName')`);
await conn.tpcEnd(xid2);
let commitNeeded1 = await conn.tpcPrepare(xid1);
let commitNeeded2 = await conn.tpcPrepare(xid2);
const commitNeeded1 = await conn.tpcPrepare(xid1);
const commitNeeded2 = await conn.tpcPrepare(xid2);
if (commitNeeded1)
await conn.tpcCommit(xid1);
if (commitNeeded2)
@ -171,7 +170,7 @@ describe('259. tpc.js', function() {
});
it('259.2.4 test tpcPrepare with no xid', async function() {
let xid = {
const xid = {
formatId: 3904,
globalTransactionId: "txn3904",
branchQualifier: "branchId"
@ -191,7 +190,7 @@ describe('259. tpc.js', function() {
it('259.2.5 negative - missing formatId in XID', async function() {
try {
let xid = {
const xid = {
globalTransactionId: "txn3900",
branchQualifier: "branchId"
};
@ -204,7 +203,7 @@ describe('259. tpc.js', function() {
it('259.2.6 negative missing globalTxnId in XID', async function() {
try {
let xid = {
const xid = {
formatId: 3900,
branchQualifier: "branchId"
};
@ -216,7 +215,7 @@ describe('259. tpc.js', function() {
it('259.2.7 negative missing branchQualifier in XID', async function() {
try {
let xid = {
const xid = {
formatId: 3900,
globalTransactionId: "txn3900",
};
@ -257,7 +256,7 @@ describe('259. tpc.js', function() {
});
it('259.3.1 test tpcBegin, tpcPrepare, tpcRollback', async function() {
let xid = {
const xid = {
formatId: 3900,
globalTransactionId: "txn3900",
branchQualifier: "branchId"
@ -277,7 +276,7 @@ describe('259. tpc.js', function() {
});
it('259.3.2 test tpcBegin, tpcPrepare, tpcCommit', async function() {
let xid = {
const xid = {
formatId: 3901,
globalTransactionId: "txn3901",
branchQualifier: "branchId"
@ -285,25 +284,24 @@ describe('259. tpc.js', function() {
await conn.tpcBegin(xid);
await conn.execute(
`INSERT INTO TBL_259_2 (IntCol, StringCol) values (1, 'testName')`);
let commitNeeded = await conn.tpcPrepare(xid);
const commitNeeded = await conn.tpcPrepare(xid);
assert.strictEqual(commitNeeded, true);
await conn.tpcCommit(xid, false);
let conn1;
conn1 = await oracledb.getConnection(dbConfig);
const conn1 = await oracledb.getConnection(dbConfig);
const result = await conn1.execute(`SELECT INTCOL FROM TBL_259_2`);
assert.strictEqual(result.rows[0][0], 1);
await conn1.close();
});
it('259.3.3 test multiple global transactions on same connection', async function() {
let xid1 = {
const xid1 = {
formatId: 3902,
globalTransactionId: "txn3902",
branchQualifier: "branch1"
};
let xid2 = {
const xid2 = {
formatId: 3902,
globalTransactionId: "txn3902",
branchQualifier: "branch2"
@ -319,8 +317,8 @@ describe('259. tpc.js', function() {
`INSERT INTO TBL_259_2 (IntCol, StringCol) VALUES (2, 'testName')`);
await conn.tpcEnd(xid2);
let commitNeeded1 = await conn.tpcPrepare(xid1);
let commitNeeded2 = await conn.tpcPrepare(xid2);
const commitNeeded1 = await conn.tpcPrepare(xid1);
const commitNeeded2 = await conn.tpcPrepare(xid2);
if (commitNeeded1)
await conn.tpcCommit(xid1);
if (commitNeeded2)
@ -334,7 +332,7 @@ describe('259. tpc.js', function() {
});
it('259.3.4 test tpcPrepare with no xid', async function() {
let xid = {
const xid = {
formatId: 3904,
globalTransactionId: "txn3904",
branchQualifier: "branchId"
@ -354,7 +352,7 @@ describe('259. tpc.js', function() {
it('259.3.5 negative - missing formatId in XID', async function() {
try {
let xid = {
const xid = {
globalTransactionId: "txn3900",
branchQualifier: "branchId"
};
@ -367,7 +365,7 @@ describe('259. tpc.js', function() {
it('259.3.6 negative missing globalTxnId in XID', async function() {
try {
let xid = {
const xid = {
formatId: 3900,
branchQualifier: "branchId"
};
@ -379,7 +377,7 @@ describe('259. tpc.js', function() {
it('259.3.7 negative missing branchQualifier in XID', async function() {
try {
let xid = {
const xid = {
formatId: 3900,
globalTransactionId: "txn3900",
};
@ -407,14 +405,14 @@ describe('259. tpc.js', function() {
});
it('259.4.1 set and get externalName', function() {
let extName = "testExternalName";
const extName = "testExternalName";
conn.externalName = extName;
assert.strictEqual(conn.externalName, extName);
});
it('259.4.2 set and get internalName', function() {
let intName = "testInternalName";
const intName = "testInternalName";
conn.internalName = intName;
assert.strictEqual(conn.internalName, intName);
@ -466,8 +464,8 @@ describe('259. tpc.js', function() {
});
it('259.5.1 test tpcBegin, tpcPrepare, tpcRollback using Buffer type', async function() {
let buf = Buffer.from(['t', 'x', 'n', '3', '9', '0', '4'], "utf-8");
let xid = {
const buf = Buffer.from(['t', 'x', 'n', '3', '9', '0', '4'], "utf-8");
const xid = {
formatId: 3904,
globalTransactionId: buf,
branchQualifier: "branchId"
@ -488,8 +486,8 @@ describe('259. tpc.js', function() {
});
it('259.5.2 test tpcBegin, tpcPrepare, tpcRollback using Buffer type 2', async function() {
let buf = Buffer.from(['b', 'r', 'a', 'n', 'c', 'h', 'I', 'd'], "utf-8");
let xid = {
const buf = Buffer.from(['b', 'r', 'a', 'n', 'c', 'h', 'I', 'd'], "utf-8");
const xid = {
formatId: 3904,
globalTransactionId: "txn3904",
branchQualifier: buf
@ -513,7 +511,7 @@ describe('259. tpc.js', function() {
describe('259.6 TPC Functions with invalid # of parameters', function() {
let conn = null;
let xid = {
const xid = {
formatId: 25960,
globalTransactionId: "txt259.6",
branchQualifier: "brancId1"

View File

@ -204,13 +204,12 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID = async function(strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid, urowidLen;
let result;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
await testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
const bindVar = {
i: { val : insertID, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
@ -257,13 +256,12 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_maxSize = async function(strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid, urowidLen;
let result;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
await testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
const bindVar = {
i: { val : insertID, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
@ -309,9 +307,8 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_update = async function(rowid_org, strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let sql_insert, bindVar, result;
let urowid, urowidLen;
let id_1 = insertID++;
let id_2 = insertID++;
const id_1 = insertID++;
const id_2 = insertID++;
sql_insert = "insert into " + tableName_normal + " (ID, content) values (:i, :c)";
bindVar = {
i: { val : id_1, dir : oracledb.BIND_IN, type : oracledb.NUMBER },
@ -331,8 +328,8 @@ describe('115. urowidDMLBindAsString2.js', function() {
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
await testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
bindVar = {
@ -374,9 +371,8 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_update_maxSize = async function(rowid_org, strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid, urowidLen;
let id_1 = insertID++;
let id_2 = insertID++;
const id_1 = insertID++;
const id_2 = insertID++;
let sql_insert, bindVar, result;
sql_insert = "insert into " + tableName_normal + " (ID, content) values (:i, :c)";
@ -398,8 +394,8 @@ describe('115. urowidDMLBindAsString2.js', function() {
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
assert(result);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
bindVar = {
@ -430,15 +426,14 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_returning = async function(strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid, urowidLen;
let sql_insert, result, bindVar;
sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
let result, bindVar;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
assert(result);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
bindVar = {
@ -468,17 +463,16 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_where = async function(strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid, urowidLen;
let sql_insert, result, bindVar;
let result, bindVar;
sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
assert(result);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, rowidLenExpected);
bindVar = {
@ -501,9 +495,8 @@ describe('115. urowidDMLBindAsString2.js', function() {
const testBigUROWID_stream = async function(maxRows, strLength, rowidLenExpected) {
const str = random.getRandomLengthString(strLength);
let urowid_1, urowidLen_1, urowid_2, urowidLen_2;
let id_1 = insertID++;
let id_2 = insertID++;
const id_1 = insertID++;
const id_2 = insertID++;
const maxRowsBak = oracledb.maxRows;
oracledb.maxRows = maxRows;
let sql_insert, result;
@ -513,13 +506,13 @@ describe('115. urowidDMLBindAsString2.js', function() {
sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_1);
urowid_1 = result.rows[0][0];
urowidLen_1 = urowid_1.length;
const urowid_1 = result.rows[0][0];
const urowidLen_1 = urowid_1.length;
testsUtil.checkUrowidLength(urowidLen_1, rowidLenExpected);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_2);
urowid_2 = result.rows[0][0];
urowidLen_2 = urowid_2.length;
const urowid_2 = result.rows[0][0];
const urowidLen_2 = urowid_2.length;
testsUtil.checkUrowidLength(urowidLen_2, rowidLenExpected);
let counter = 0;
@ -535,7 +528,7 @@ describe('115. urowidDMLBindAsString2.js', function() {
stream.on('data', function(data) {
assert(data != null);
counter++;
let result_id = data[0];
const result_id = data[0];
if (result_id === id_1) {
assert.deepStrictEqual(data, [ id_1, str, urowid_1 ]);
} else {

View File

@ -205,13 +205,12 @@ describe('142. urowidFunctionBindAsString3.js', function() {
const funBindOut = async function(fun_exec, expectedLength) {
const str = random.getRandomLengthString(expectedLength);
let urowid, urowidLen;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
assert(result);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, expectedLength);
const bindVar_in = {
i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
@ -229,22 +228,21 @@ describe('142. urowidFunctionBindAsString3.js', function() {
const funBindOut_update = async function(fun_exec, contentLen_1, contentLen_2) {
const str_1 = random.getRandomLengthString(contentLen_1);
const str_2 = random.getRandomLengthString(contentLen_2);
let urowid_1, urowid_2, urowidLen_1, urowidLen_2, id_1, id_2;
id_1 = insertID;
const id_1 = insertID;
let sql_insert = "insert into " + tableName_indexed + " values (" + id_1 + ", '" + str_1 + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_1);
assert(result);
urowid_1 = result.rows[0][0];
urowidLen_1 = urowid_1.length;
const urowid_1 = result.rows[0][0];
const urowidLen_1 = urowid_1.length;
testsUtil.checkUrowidLength(urowidLen_1, contentLen_1);
id_2 = insertID + 1;
const id_2 = insertID + 1;
sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str_2 + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_2);
assert(result);
urowid_2 = result.rows[0][0];
urowidLen_2 = urowid_2.length;
const urowid_2 = result.rows[0][0];
const urowidLen_2 = urowid_2.length;
testsUtil.checkUrowidLength(urowidLen_2, contentLen_2);
const bindVar_in = {
i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },

View File

@ -209,13 +209,12 @@ describe('143. urowidFunctionBindAsString4.js', function() {
const funBindInOut = async function(fun_execute, expectedLength) {
const str = random.getRandomLengthString(expectedLength);
let urowid, urowidLen;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
assert(result);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, expectedLength);
const bindVar_in = {
i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
@ -235,23 +234,22 @@ describe('143. urowidFunctionBindAsString4.js', function() {
const funBindOut_update = async function(fun_exec, contentLen_1, contentLen_2) {
const str_1 = random.getRandomLengthString(contentLen_1);
const str_2 = random.getRandomLengthString(contentLen_2);
let urowid_1, urowid_2, urowidLen_1, urowidLen_2, id_1, id_2;
id_1 = insertID;
const id_1 = insertID;
let sql_insert = "insert into " + tableName_indexed + " values (" + id_1 + ", '" + str_1 + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_1);
assert(result);
urowid_1 = result.rows[0][0];
urowidLen_1 = urowid_1.length;
const urowid_1 = result.rows[0][0];
const urowidLen_1 = urowid_1.length;
testsUtil.checkUrowidLength(urowidLen_1, contentLen_1);
id_2 = insertID + 1;
const id_2 = insertID + 1;
sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str_2 + "')";
await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_2);
assert(result);
urowid_2 = result.rows[0][0];
urowidLen_2 = urowid_2.length;
const urowid_2 = result.rows[0][0];
const urowidLen_2 = urowid_2.length;
testsUtil.checkUrowidLength(urowidLen_2, contentLen_2);
const bindVar_in = {
i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },

View File

@ -196,13 +196,12 @@ describe('144. urowidProcedureBindAsString4.js', function() {
const procedureBindIn = async function(proc_execute, expectedLength) {
const str = random.getRandomLengthString(expectedLength);
let urowid, urowidLen;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, expectedLength);
const bindVar_in = {
@ -221,22 +220,20 @@ describe('144. urowidProcedureBindAsString4.js', function() {
const procedureBindIn_update = async function(proc_execute, contentLen_1, contentLen_2) {
const str_1 = random.getRandomLengthString(contentLen_1);
const str_2 = random.getRandomLengthString(contentLen_2);
let urowid_1, urowid_2, urowidLen_1, urowidLen_2, id_1, id_2;
id_1 = insertID;
const id_1 = insertID;
let sql_insert = "insert into " + tableName_indexed + " values (" + id_1 + ", '" + str_1 + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_1);
urowid_1 = result.rows[0][0];
urowidLen_1 = urowid_1.length;
const urowid_1 = result.rows[0][0];
const urowidLen_1 = urowid_1.length;
testsUtil.checkUrowidLength(urowidLen_1, contentLen_1);
id_2 = insertID + 1;
const id_2 = insertID + 1;
sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str_2 + "')";
result = await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_2);
urowid_2 = result.rows[0][0];
urowidLen_2 = urowid_2.length;
const urowid_2 = result.rows[0][0];
const urowidLen_2 = urowid_2.length;
testsUtil.checkUrowidLength(urowidLen_2, contentLen_2);
const bindVar_in = {

View File

@ -166,12 +166,11 @@ describe('145. urowidProcedureBindAsString5.js', function() {
const procedureBindOut = async function(proc_execute, expectedLength) {
const str = random.getRandomLengthString(expectedLength);
let urowid, urowidLen;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, expectedLength);
const bindVar_out = {
i: { val: insertID, type: oracledb.NUMBER, dir: oracledb.BIND_IN },

View File

@ -200,12 +200,11 @@ describe('146. urowidProcedureBindAsString6.js', function() {
const procedureBindInout = async function(proc_execute, expectedLength) {
const str = random.getRandomLengthString(expectedLength);
let urowid, urowidLen;
const sql_insert = "insert into " + tableName_indexed + " values (" + insertID + ", '" + str + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + insertID);
urowid = result.rows[0][0];
urowidLen = urowid.length;
const urowid = result.rows[0][0];
const urowidLen = urowid.length;
testsUtil.checkUrowidLength(urowidLen, expectedLength);
const bindVar_inout = {
@ -220,20 +219,19 @@ describe('146. urowidProcedureBindAsString6.js', function() {
const procedureBindInout_update = async function(proc_execute, contentLen_1, contentLen_2) {
const str_1 = random.getRandomLengthString(contentLen_1);
const str_2 = random.getRandomLengthString(contentLen_2);
let urowid_1, urowid_2, urowidLen_1, urowidLen_2, id_1, id_2;
id_1 = insertID;
const id_1 = insertID;
let sql_insert = "insert into " + tableName_indexed + " values (" + id_1 + ", '" + str_1 + "')";
await connection.execute(sql_insert);
let result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_1);
urowid_1 = result.rows[0][0];
urowidLen_1 = urowid_1.length;
const urowid_1 = result.rows[0][0];
const urowidLen_1 = urowid_1.length;
testsUtil.checkUrowidLength(urowidLen_1, contentLen_1);
id_2 = insertID + 1;
const id_2 = insertID + 1;
sql_insert = "insert into " + tableName_indexed + " values (" + id_2 + ", '" + str_2 + "')";
result = await connection.execute(sql_insert);
result = await connection.execute("select ROWID from " + tableName_indexed + " where c1 = " + id_2);
urowid_2 = result.rows[0][0];
urowidLen_2 = urowid_2.length;
const urowid_2 = result.rows[0][0];
const urowidLen_2 = urowid_2.length;
testsUtil.checkUrowidLength(urowidLen_2, contentLen_2);
const bindVar_inout = {

View File

@ -89,7 +89,7 @@ describe('248. userName.js', function() {
}); // 248.1.1
it('248.1.2 test with username size 100', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (dbConfig.test.drcp || !runnable) {
this.skip();
}
@ -104,7 +104,7 @@ describe('248. userName.js', function() {
connectString: dbConfig.connectString
};
let conn = await oracledb.getConnection(credential);
const conn = await oracledb.getConnection(credential);
assert(conn);
await conn.close();
@ -113,7 +113,7 @@ describe('248. userName.js', function() {
}); // 248.1.2
it('248.1.3 test with username size 128', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (dbConfig.test.drcp || !runnable) {
this.skip();
}
@ -137,7 +137,7 @@ describe('248. userName.js', function() {
}); // 248.1.3
it('248.1.4 test with username size 1000', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (!runnable) {
this.skip();
}
@ -266,7 +266,7 @@ describe('248. userName.js', function() {
}); // 248.2.1
it('248.2.2 test with user size 100', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (dbConfig.test.drcp || !runnable) {
this.skip();
}
@ -289,7 +289,7 @@ describe('248. userName.js', function() {
}); // 248.2.2
it('248.2.3 test with user size 128', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (dbConfig.test.drcp || !runnable) {
this.skip();
}
@ -313,7 +313,7 @@ describe('248. userName.js', function() {
}); // 248.2.3
it('248.2.4 test with username size 1000', async function() {
let runnable = await testsUtil.isLongUserNameRunnable();
const runnable = await testsUtil.isLongUserNameRunnable();
if (!runnable) {
this.skip();
}