Skip to content

Commit 6b28cb3

Browse files
committed
Show clientInitiated option in CQN example
1 parent e42b733 commit 6b28cb3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

doc/api.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ Constant Name | Value | Descripti
11831183

11841184
#### <a name="oracledbconstantscqn"></a> 3.1.9 Continuous Query Notification Constants
11851185

1186-
Constants for the Continuous Query Notification
1186+
Constants for the [Continuous Query Notification (CQN)](#cqn)
11871187
`connection.subscribe()` option [`operations`](#consubscribeoptoperations), and for the
11881188
notification message [`operation`](#consubscribeoptcallback) properties.
11891189

@@ -16347,8 +16347,9 @@ function myCallback(message) {
1634716347
}
1634816348

1634916349
const options = {
16350-
sql : `SELECT * FROM mytable`, // query of interest
16351-
callback : myCallback // method called by notifications
16350+
sql : `SELECT * FROM mytable`, // query of interest
16351+
callback : myCallback, // method called by notifications
16352+
clientInitiated : true // For Oracle DB & Client 19.4 or later
1635216353
};
1635316354

1635416355
await connection.subscribe('mysub', options);

examples/cqn1.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* The user must have been granted CHANGE NOTIFICATION.
2626
* The node-oracledb host must be resolvable by the database host.
2727
*
28-
* Run this script and when the subscription has been created, run
28+
* Run this script and then, after the subscription has been created, run
2929
* these statements in a SQL*Plus session:
3030
* INSERT INTO NO_CQNTABLE VALUES (101);
3131
* COMMIT;
@@ -98,11 +98,13 @@ const options = {
9898
callback : myCallback,
9999
sql: `SELECT * FROM no_cqntable WHERE k > :bv`,
100100
binds: { bv : 100 },
101-
timeout : 60, // Stop after 60 seconds
102-
// ipAddress: '127.0.0.1',
103-
// SUBSCR_QOS_QUERY: generate notifications when rows with k > 100 are changed
104-
// SUBSCR_QOS_ROWIDS: Return ROWIDs in the notification message
105-
qos : oracledb.SUBSCR_QOS_QUERY | oracledb.SUBSCR_QOS_ROWIDS
101+
timeout: 60, // stop after 60 seconds
102+
clientInitiated: true, // for Oracle Database & Client 19.4 or later
103+
// ipAddress: '127.0.0.1', // where Node.js runs (when not using clientInitiated)
104+
// qos flags:
105+
// SUBSCR_QOS_QUERY: generate notifications when rows with k > 100 are changed
106+
// SUBSCR_QOS_ROWIDS: return ROWIDs in the notification message
107+
qos: oracledb.SUBSCR_QOS_QUERY | oracledb.SUBSCR_QOS_ROWIDS
106108
};
107109

108110
async function setup(connection) {

0 commit comments

Comments
 (0)