Documentation, test and example updates

This commit is contained in:
Sharad Chandran R 2023-11-09 20:13:49 +05:30
parent e6d2c592ca
commit f79f7bab57
9 changed files with 73 additions and 68 deletions

View File

@ -684,11 +684,13 @@ Constants for :ref:`AqEnqOptions Class <aqenqoptionsclass>` and
Continuous Query Notification (CQN) Constants
---------------------------------------------
Constants for the Continuous Query Notification (CQN)
``connection.subscribe()`` option
:ref:`operations <consubscribeoptoperations>`, and for the
notification message :ref:`operation <consubscribeoptcallback>`
properties.
Constants for the Continuous Query Notification (CQN) comprises all the
possible integer mask values for the following properties of the ``options``
parameter in the :meth:`connection.subscribe()` method:
- :ref:`operations <consubscribeoptoperations>` property
- :ref:`operation <consubscribeoptcallback>` property in the
:ref:`message <messageparam>` parameter
.. list-table-with-summary:: Constants for the connection.subscribe() option
``operations`` and notification message ``operation`` Properties.

View File

@ -167,7 +167,12 @@ async function run() {
// Configuration for accessTokenConfig:
// clientId: Must be set to app id of Azure's application
// authority: Must be set to a string, in URI format with tenant
// https://{uri}/{tenantId}
// https://{identity provider instance}/{tenantId}
// Common authority URLs:
// https://login.microsoftonline.com/<tenant>/
// https://login.microsoftonline.com/common/
// https://login.microsoftonline.com/organizations/
// https://login.microsoftonline.com/consumers/
// scopes: Must be set https://{uri}/clientID/.default for client
// credential flows
// clientSecret: Can be set only when authType property is set to

View File

@ -56,7 +56,6 @@ describe('181. dataTypeXML.js', function() {
before('create table and insert a row', async function() {
if (oracledb.thin) {
this.skip();
return;
}
const connection = await oracledb.getConnection(dbConfig);
@ -175,7 +174,7 @@ describe('181. dataTypeXML.js', function() {
}); // 181.4
// ORA-19011: Character string buffer too small
it.skip('181.5 inserts data that larger than 4K', async () => {
it.skip('181.5 inserts data that is larger than 4K', async () => {
const ID = 50;
const str = 'a'.repeat(31 * 1024);

View File

@ -128,8 +128,8 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(`drop table employees PURGE`);
await connection.execute(`drop table departments PURGE`);
await connection.execute(testsUtil.sqlDropTable(`employees`));
await connection.execute(testsUtil.sqlDropTable(`departments`));
await connection.execute(`drop view emp_ov`);
await connection.execute(`drop view dept_ov`);
await connection.close();
@ -291,8 +291,8 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(`drop table employees PURGE`);
await connection.execute(`drop table departments PURGE`);
await connection.execute(testsUtil.sqlDropTable(`employees`));
await connection.execute(testsUtil.sqlDropTable(`departments`));
await connection.execute(`drop view emp_ov`);
await connection.execute(`drop view dept_ov`);
await connection.close();
@ -454,9 +454,9 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(`drop table student_class`);
await connection.execute(`drop table class`);
await connection.execute(`drop table student`);
await connection.execute(testsUtil.sqlDropTable(`student_class`));
await connection.execute(testsUtil.sqlDropTable(`class`));
await connection.execute(testsUtil.sqlDropTable(`student`));
await connection.close();
});

View File

@ -96,7 +96,7 @@ describe('273. jsonDualityView2.js', function() {
const result = await connection.execute(`select * from student order by 1`);
assert.strictEqual(result.rows.length, 3);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
it('273.2 Base table name with various sizes (128)', async function() {
@ -116,8 +116,8 @@ describe('273. jsonDualityView2.js', function() {
{StudentId: stuid , StudentName: name}`);
await connection.execute(`drop table hTKFRCNOJyYYvuyUvKsEWhfuObJBjBNnzLVuwqR` +
`faqQAdtXBKxOHeheawjKeezZbgmfJJRhovKkhtwTXXnTWYpojdeawBFuAxPNaDAPjxuRzdpzYcHYwYggVCQueeXiv PURGE`);
await connection.execute(testsUtil.sqlDropTable(`hTKFRCNOJyYYvuyUvKsEWhfuObJBjBNnzLVuwqR` +
`faqQAdtXBKxOHeheawjKeezZbgmfJJRhovKkhtwTXXnTWYpojdeawBFuAxPNaDAPjxuRzdpzYcHYwYggVCQueeXiv`));
});
it('273.3 Perform dbms_metadata.get_ddl() and verify tags were properly added to columns and tables', async function() {
@ -168,7 +168,7 @@ describe('273. jsonDualityView2.js', function() {
{stuid, NOINSERT }`);
const result = await connection.execute(`select * from student order by 1`);
assert.strictEqual(result.rows.length, 3);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
it('273.6 Specify DELETE, NODELETE both, BUG number : 34657745', async function() {
@ -201,7 +201,7 @@ describe('273. jsonDualityView2.js', function() {
/ORA-40934:/ //ORA-40934: Cannot create JSON Relational Duality View 'STUDENT_OV':
//Invalid or c onflicting annotations in the WITH clause.
);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
it('273.7 Repetitive tags', async function() {
@ -226,7 +226,7 @@ describe('273. jsonDualityView2.js', function() {
/ORA-40947:/ //ORA-40947: A JSON relational duality view is created with duplicate tag 'INSERT'
);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
describe('273.3 Verify view creation on different types of tables', function() {
@ -247,20 +247,20 @@ describe('273. jsonDualityView2.js', function() {
});
after(async function() {
await connection.execute('drop table student PURGE');
await connection.execute(testsUtil.sqlDropTable('student'));
});
it('273.3.1 View with Heap', async function() {
await connection.execute(`CREATE TABLE t1 (c1 NUMBER PRIMARY KEY, c2 VARCHAR2(30)) ORGANIZATION HEAP`);
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW heap AS t1{c1,c2}`);
await connection.execute(`drop table t1 PURGE`);
await connection.execute(testsUtil.sqlDropTable(`t1`));
await connection.execute(`drop view heap`);
});
it('273.3.2 View with IOT', async function() {
await connection.execute(`CREATE TABLE my_iot (id INTEGER PRIMARY KEY, value VARCHAR2(50)) ORGANIZATION INDEX`);
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW iot AS my_iot{id,value}`);
await connection.execute(`drop table my_iot PURGE`);
await connection.execute(testsUtil.sqlDropTable(`my_iot`));
await connection.execute(`drop view iot`);
});
@ -281,7 +281,7 @@ describe('273. jsonDualityView2.js', function() {
` ))\n` +
`)`);
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW partition AS sales{prod_id,cust_id}`);
await connection.execute(`drop table sales PURGE`);
await connection.execute(testsUtil.sqlDropTable(`sales`));
await connection.execute(`drop view partition`);
});
@ -310,7 +310,7 @@ describe('273. jsonDualityView2.js', function() {
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW GTT\n` +
`AS today_sales{order_id}`);
await connection.execute(`drop table today_sales PURGE`);
await connection.execute(testsUtil.sqlDropTable(`today_sales`));
await connection.execute(`drop view GTT`);
});
});
@ -406,7 +406,7 @@ describe('273. jsonDualityView2.js', function() {
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov AS unq_idx_demo{a,b}
`);
await connection.execute(`drop table unq_idx_demo PURGE`);
await connection.execute(testsUtil.sqlDropTable(`unq_idx_demo`));
await connection.execute('drop view student_ov');
});
@ -430,7 +430,7 @@ describe('273. jsonDualityView2.js', function() {
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov AS cmp_idx_demo{a,b}
`);
await connection.execute(`drop table cmp_idx_demo PURGE`);
await connection.execute(testsUtil.sqlDropTable(`cmp_idx_demo`));
await connection.execute('drop view student_ov');
});
@ -450,7 +450,7 @@ describe('273. jsonDualityView2.js', function() {
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov AS members{id,a__b:first_name}
`);
await connection.execute(`drop table MEMBERS PURGE`);
await connection.execute(testsUtil.sqlDropTable(`MEMBERS`));
await connection.execute('drop view student_ov');
});
@ -471,7 +471,7 @@ describe('273. jsonDualityView2.js', function() {
await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov AS bitmap_index_demo{id,active}`);
await connection.execute(`drop table bitmap_index_demo PURGE`);
await connection.execute(testsUtil.sqlDropTable(`bitmap_index_demo`));
await connection.execute('drop view student_ov');
});
});
@ -546,7 +546,7 @@ describe('273. jsonDualityView2.js', function() {
/ORA-63101:/ //ORA-63101: JSON Duality View Entity Tag (ETAG) column cannot be redacted
);
await conn.execute(`drop table redact PURGE`);
await conn.execute(testsUtil.sqlDropTable(`redact`));
await conn.close();
});
});

View File

@ -139,7 +139,7 @@ describe('274 jsonDualityView3.js', function() {
StudentId: stuid, StudentName: name
}
`);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
await connection.execute(`drop view student_ov`);
});
@ -169,7 +169,7 @@ describe('274 jsonDualityView3.js', function() {
//ORA-40945: Column 'GROSS_MARGIN' of table 'PARTS' cannot be selected in JSON
//relational duality view as it is virtual.
);
await connection.execute(`drop table parts PURGE`);
await connection.execute(testsUtil.sqlDropTable(`parts`));
});
it('274.3 Have columns of all scalar types, including FLOAT, TIMESTAMP, TIMESTAMP WITH TIME ZONE', async function() {
@ -202,7 +202,7 @@ describe('274 jsonDualityView3.js', function() {
}
`);
await connection.execute(`drop table stores PURGE`);
await connection.execute(testsUtil.sqlDropTable(`stores`));
await connection.execute(`drop view student_ov`);
});
@ -222,7 +222,7 @@ describe('274 jsonDualityView3.js', function() {
/ORA-00904:/ //ORA-00904: "SCOTTY__STUDENT__STUID": invalid identifier
);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
it('274.5 Select over Invisible columns', async function() {
@ -259,7 +259,7 @@ describe('274 jsonDualityView3.js', function() {
ORDER BY 1 ASC
`);
assert.deepStrictEqual(result2.rows, [['ABC'], ['LMN'], ['XYZ']]);
await connection.execute(`drop table student1 PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student1`));
});
it('274.6 Add is (Ex: "deptno" IS d.department_id)', async function() {
@ -285,7 +285,7 @@ describe('274 jsonDualityView3.js', function() {
AS student{stuid: stuid, StudentName: name}
`);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
await connection.execute(`drop view student_ov`);
});
@ -305,7 +305,7 @@ describe('274 jsonDualityView3.js', function() {
/ORA-00904:/ //ORA-00904: "INVISIBLE": invalid identifier
);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
});
it('274.8 Create view on NULL columns - empty columns', async function() {
@ -333,7 +333,7 @@ describe('274 jsonDualityView3.js', function() {
ORDER BY 1 ASC
`);
assert.deepStrictEqual(result.rows, [[1], [2], [3]]);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable(`student`));
await connection.execute(`drop view student_ov`);
});
});

View File

@ -181,7 +181,7 @@ describe('275. jsonDualityView4.js', function() {
assert.deepStrictEqual(result.rows[0], [13, "ABC", "XYZ"]);
// DROP the tables
await connection.execute(`DROP TABLE Persons`);
await connection.execute(`DROP TABLE IF EXISTS Persons`);
});
it('275.3 Test with Virtual columns', async function() {
@ -718,10 +718,10 @@ describe('275. jsonDualityView4.js', function() {
);
// drop table student_class
await connection.execute(`DROP TABLE student_class`);
await connection.execute(`DROP TABLE IF EXISTS student_class`);
// drop table student
await connection.execute(`DROP TABLE student`);
await connection.execute(`DROP TABLE IF EXISTS student`);
// create table student
await connection.execute(`
@ -809,7 +809,7 @@ describe('275. jsonDualityView4.js', function() {
FROM student_ov
ORDER BY data.StudentName DESC, json_value(data, '$.StudentId') ASC
`);
assert.deepStrictEqual(result7.rows, [['H', 19], ['F', 4], ['E', 8], ['D', 12], ['C', 81], ['B', 9], ['A', 1]]);
assert.deepStrictEqual(result7.rows, [['H', '19'], ['F', '4'], ['E', '8'], ['D', '12'], ['C', '81'], ['B', '9'], ['A', '1']]);
});
});
});

View File

@ -100,10 +100,9 @@ describe('276. jsonDualityView5.js', function() {
after(async function() {
if (!isRunnable || dbConfig.test.isCmanTdm) return;
//await connection.execute(`drop table student_class PURGE`);
await connection.execute(`drop table student_class PURGE`);
await connection.execute(`drop table class PURGE`);
await connection.execute(`drop table student PURGE`);
await connection.execute(testsUtil.sqlDropTable('student_class'));
await connection.execute(testsUtil.sqlDropTable('class'));
await connection.execute(testsUtil.sqlDropTable('student'));
await connection.close();
await dbaConn.execute(`drop user njs_jsonDv5 cascade`);
@ -532,7 +531,7 @@ describe('276. jsonDualityView5.js', function() {
StudentClass :
student_class @insert@update@delete
{StudentClassId : scid,
Class : class {ClassId: clsid, Name: name}}}
Class : class {ClassId: clsid, Name: name}}}
`),
/ORA-40934:/ /*ORA-40934: Cannot create JSON Relational Duality View 'STUDENT_OV': Invalid or
conflicting annotations in the WITH clause */
@ -561,7 +560,7 @@ describe('276. jsonDualityView5.js', function() {
StudentClass :
student_class @insert@update@delete
{StudentClassId : scid,
Class : class {ClassId: clsid, Name: name}}}
Class : class {ClassId: clsid, Name: name}}}
`);
await assert.rejects(

View File

@ -172,7 +172,7 @@ describe('277. jsonDualityView6.js', function() {
assert.strictEqual(result.rows.length, 3);
assert.strictEqual(result.rows[0][0].student_id, 3);
assert.strictEqual(result.rows[0][0].student_name, "Shashank");
assert.Strict(result.rows[0][0].student_class, [{"student_class_id": 3, "student_id": 3}]);
assert.deepStrictEqual(result.rows[0][0].student_class, [{"student_class_id": 3, "student_id": 3}]);
await connection.execute(`
CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov
@ -252,53 +252,53 @@ describe('277. jsonDualityView6.js', function() {
it('277.1.2.1 With SNT', async function() {
let result = await connection.execute(`select o.data.StudentId as name from student_ov o
order by o.data.StudentId`);
assert.Strict(result.rows, [[1], [2], [3]]);
assert.deepStrictEqual(result.rows, [[1], [2], [3]]);
result = await connection.execute(`select o.data.StudentName as name from student_ov o
order by o.data.StudentName`);
assert.Strict(result.rows, [['Ajit'], ['Shashank'], ['Tirthankar']]);
assert.deepStrictEqual(result.rows, [['Ajit'], ['Shashank'], ['Tirthankar']]);
result = await connection.execute(`select o.data.StudentClass.StudentClassId from student_ov o
order by o.data desc
fetch first 2 rows only`);
assert.Strict(result.rows, [[3], [2]]);
assert.deepStrictEqual(result.rows, [[3], [2]]);
result = await connection.execute(`select o.data.StudentClass from student_ov o
order by o.data desc`);
assert.Strict(result.rows[0][0], [{"StudentClassId": 3, "StudentId": 3}]);
assert.Strict(result.rows[1][0], [{"StudentClassId": 2, "StudentId": 2}]);
assert.Strict(result.rows[2][0], [{"StudentClassId": 1, "StudentId": 1}]);
assert.deepStrictEqual(result.rows[0][0], [{"StudentClassId": 3, "StudentId": 3}]);
assert.deepStrictEqual(result.rows[1][0], [{"StudentClassId": 2, "StudentId": 2}]);
assert.deepStrictEqual(result.rows[2][0], [{"StudentClassId": 1, "StudentId": 1}]);
result = await connection.execute(`select o.data.StudentClass.StudentId,o.data.StudentId from student_ov o
order by 1`);
assert.Strict(result.rows, [[1, 1], [2, 2], [3, 3]]);
assert.deepStrictEqual(result.rows, [[1, 1], [2, 2], [3, 3]]);
});
it('277.1.2.2 SNT+where clause)', async function() {
let result = await connection.execute(`select o.data.StudentId from student_ov o
where o.data.StudentId in (1,3) order by 1`);
assert.Strict(result.rows, [[1], [3]]);
assert.deepStrictEqual(result.rows, [[1], [3]]);
result = await connection.execute(`select distinct o.data.StudentId from student_ov o
where o.data.StudentId between 1 and 5 order by 1 desc`);
assert.Strict(result.rows, [[3], [2], [1]]);
assert.deepStrictEqual(result.rows, [[3], [2], [1]]);
result = await connection.execute(`select o.data.StudentId,o.data.StudentName as name from student_ov o
where o.data.StudentId=2 and o.data.StudentId!=3 order by o.data.StudentName`);
assert.Strict(result.rows, [[2, "Tirthankar"]]);
assert.deepStrictEqual(result.rows, [[2, "Tirthankar"]]);
result = await connection.execute(`select o.data.StudentId,o.data.StudentClass.StudentId as clsid from student_ov o
where o.data.StudentId>=2 and o.data.StudentName='Shashank' order by o.data.StudentId`);
assert.Strict(result.rows, [[3, 3]]);
assert.deepStrictEqual(result.rows, [[3, 3]]);
result = await connection.execute(`select o.data.StudentId from student_ov o
where o.data.StudentId=1 or o.data.StudentClass.StudentId=3 order by o.data.StudentId desc
fetch first 2 rows only`);
assert.Strict(result.rows, [[3], [1]]);
assert.deepStrictEqual(result.rows, [[3], [1]]);
result = await connection.execute(`select o.data.StudentId.number() from student_ov o
where o.data.StudentId like '%3%' order by o.data.StudentId desc`);
assert.Strict(result.rows, [[3]]);
assert.deepStrictEqual(result.rows, [[3]]);
});
});
});
@ -375,7 +375,7 @@ describe('277. jsonDualityView6.js', function() {
assert.strictEqual(result.rows.length, 3);
assert.strictEqual(result.rows[0][0].StudentId, 1);
assert.strictEqual(result.rows[0][0].StudentName, "Ajit");
assert.Strict(result.rows[0][0].StudentClass, [{"StudentClassId": 1,
assert.deepStrictEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1,
"StudentId": 1, "Class": [{"ClassId": 1, "Name": "CS101"}]}]);
});
@ -406,9 +406,9 @@ describe('277. jsonDualityView6.js', function() {
const result = await connection.execute(`select * from student_ov`);
assert.strictEqual(result.rows.length, 3);
assert.Strict(result.rows[0][0]._id, {"stuid": 1});
assert.deepStrictEqual(result.rows[0][0]._id, {"stuid": 1});
assert.strictEqual(result.rows[0][0].StudentName, "Ajit");
assert.Strict(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
assert.deepStrictEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
"Class": [{"ClassId": 1, "Name": "CS101"}]}]);
});
@ -453,9 +453,9 @@ describe('277. jsonDualityView6.js', function() {
let result = await connection.execute(`select * from abc1`);
assert.strictEqual(result.rows.length, 1);
assert.Strict(result.rows[0][0].StudentId, 1);
assert.deepStrictEqual(result.rows[0][0].StudentId, 1);
assert.strictEqual(result.rows[0][0].StudentName, "Ajit");
assert.Strict(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
assert.deepStrictEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
"Class": [{"ClassId": 1, "Name": "CS101"}]}]);
await connection.execute(`create table abc2
as select json_value(data,'$.StudentId') col