Added new env variable and automatic AQ table and queue for examples and test updates
This commit is contained in:
parent
fbe6e7a58a
commit
c31fb33395
|
@ -13,12 +13,11 @@ node-oracledb `v6.3.0 <https://github.com/oracle/node-oracledb/compare/v6.2.0...
|
|||
Common Changes
|
||||
++++++++++++++
|
||||
|
||||
#) Added support for fetching VARCHAR2 and LOB columns which contain JSON (and
|
||||
have the "IS JSON" check constraint enabled) in the same way as columns of
|
||||
type JSON (which requires Oracle Database 21 or higher) are fetched. In
|
||||
thick mode this requires Oracle Client 19 or higher. Application can
|
||||
get the old behaviour and avoid this conversion by defining
|
||||
:attr:`oracledb.fetchTypeHandler`.
|
||||
#) VARCHAR2 and LOB columns which contain JSON, and have the "IS JSON" check
|
||||
constraint enabled, are now fetched in the same way as columns of type
|
||||
JSON. In node-oracledb :ref:`Thick mode <enablingthick>` this requires
|
||||
Oracle Client 19 or higher. Applications can get the old behaviour by using
|
||||
:attr:`oracledb.fetchTypeHandler` to replace the new default conversion.
|
||||
|
||||
#) Added new connection properties :attr:`connection.dbDomain`,
|
||||
:attr:`connection.dbName`, :attr:`connection.maxOpenCursors`,
|
||||
|
@ -31,6 +30,15 @@ Common Changes
|
|||
``annotations``, ``domainName``, ``domainSchema`` and ``isJson`` for a
|
||||
fetched column.
|
||||
|
||||
#) Added new environment variable ``NODE_ORACLEDB_CLIENT_LIB_DIR`` to set
|
||||
an optional Oracle Client library path for the files in the ``examples``
|
||||
directory on Windows and macOS Intel platforms, when using the Thick mode.
|
||||
|
||||
#) Added functionality to create and drop user schemas for
|
||||
Advanced Queuing(AQ) sample files in the ``examples`` directory. Users
|
||||
can now simply run the AQ samples using Node.js without requiring any
|
||||
external setup of the AQ user schema, queues and tables.
|
||||
|
||||
Thin Mode Changes
|
||||
++++++++++++++++++
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ Autonomous Databases optionally. The wallet location can also be provided as a p
|
|||
|
||||
- `NODE_ORACLEDB_WALLET_PASSWORD` must set to the password for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud Autonomous Databases.
|
||||
|
||||
- `NODE_ORACLEDB_CLIENT_LIB_DIR` provides an optional path for the Oracle Client libraries to be used on Windows and macOS platforms, when using Thick mode in node-oracledb.
|
||||
|
||||
Review the examples and then run them individually. For example, to see what
|
||||
the file `example.js` does, use:
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
* DESCRIPTION
|
||||
* Oracle Advanced Queuing (AQ) example passing multiple messages.
|
||||
*
|
||||
* Before running this, a queue allowing RAW payloads must be
|
||||
* created, see https://node-oracledb.readthedocs.io/en/latest/user_guide/aq.html#aqrawexample
|
||||
* Warning: Creates and drops a new user for running AQ operations.
|
||||
* Requires NODE_ORACLEDB_DBA_USER and NODE_ORACLE_DBA_PASSWORD env variables
|
||||
* to be set for the AQ user to be created and dropped.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -39,7 +40,7 @@ Error.stackTraceLimit = 50;
|
|||
|
||||
const oracledb = require('oracledb');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
|
||||
const aqUtil = require('./aqutil.js');
|
||||
|
||||
// This example requires node-oracledb Thick mode.
|
||||
//
|
||||
|
@ -51,20 +52,52 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
const queueName = "DEMO_RAW_QUEUE";
|
||||
const RAW_TABLE = "NODB_RAW_QUEUE_TAB";
|
||||
const AQ_USER = "NODB_SCHEMA_AQTEST1";
|
||||
const AQ_USER_PWD = aqUtil.generateRandomPassword();
|
||||
|
||||
let connection;
|
||||
|
||||
const credentials = {
|
||||
user: AQ_USER,
|
||||
password: AQ_USER_PWD,
|
||||
connectString: dbConfig.connectString
|
||||
};
|
||||
|
||||
async function aqSetup() {
|
||||
await aqUtil.createAQtestUser(AQ_USER, AQ_USER_PWD);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const plsql = `
|
||||
BEGIN
|
||||
DBMS_AQADM.CREATE_QUEUE_TABLE(
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}',
|
||||
QUEUE_PAYLOAD_TYPE => 'RAW'
|
||||
);
|
||||
DBMS_AQADM.CREATE_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}',
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}'
|
||||
);
|
||||
DBMS_AQADM.START_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}'
|
||||
);
|
||||
END;
|
||||
`;
|
||||
await connection.execute(plsql);
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
async function enq() {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName);
|
||||
queue.enqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Send a message without requiring a commit
|
||||
|
||||
|
@ -95,10 +128,9 @@ async function enq() {
|
|||
}
|
||||
|
||||
async function deq() {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName);
|
||||
queue.deqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Change the visibility so no explicit commit is required
|
||||
|
||||
|
@ -123,5 +155,11 @@ async function deq() {
|
|||
}
|
||||
}
|
||||
|
||||
enq();
|
||||
deq();
|
||||
async function run() {
|
||||
await aqSetup();
|
||||
await enq();
|
||||
await deq();
|
||||
await aqUtil.dropAQtestUser(AQ_USER);
|
||||
}
|
||||
|
||||
run();
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
* DESCRIPTION
|
||||
* Oracle Advanced Queuing (AQ) example passing an Oracle Database object
|
||||
*
|
||||
* Before running this, a queue allowing an Oracle Database object
|
||||
* payload must be created, see
|
||||
* https://node-oracledb.readthedocs.io/en/latest/user_guide/aq.html#aqobjexample
|
||||
* Warning: Creates and drops a new user for running AQ operations.
|
||||
* Requires NODE_ORACLEDB_DBA_USER and NODE_ORACLE_DBA_PASSWORD env variables
|
||||
* to be set for the AQ user to be created and dropped.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -40,6 +40,7 @@ Error.stackTraceLimit = 50;
|
|||
|
||||
const oracledb = require('oracledb');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
const aqUtil = require('./aqutil.js');
|
||||
|
||||
// This example requires node-oracledb Thick mode.
|
||||
//
|
||||
|
@ -51,18 +52,59 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
const queueName = "ADDR_QUEUE";
|
||||
const ADDR_TABLE = "ADDR_QUEUE_TAB";
|
||||
const DB_OBJECT = "USER_ADDRESS_TYPE";
|
||||
const AQ_USER = "NODB_SCHEMA_AQTEST1";
|
||||
const AQ_USER_PWD = aqUtil.generateRandomPassword();
|
||||
|
||||
let connection;
|
||||
|
||||
const credentials = {
|
||||
user: AQ_USER,
|
||||
password: AQ_USER_PWD,
|
||||
connectString: dbConfig.connectString
|
||||
};
|
||||
|
||||
async function aqSetup() {
|
||||
await aqUtil.createAQtestUser(AQ_USER, AQ_USER_PWD);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const createTypeSql = `
|
||||
CREATE OR REPLACE TYPE ${AQ_USER}.${DB_OBJECT} AS OBJECT (
|
||||
NAME VARCHAR2(10),
|
||||
ADDRESS VARCHAR2(50)
|
||||
);
|
||||
`;
|
||||
await connection.execute(createTypeSql);
|
||||
|
||||
const plsql = `
|
||||
BEGIN
|
||||
DBMS_AQADM.CREATE_QUEUE_TABLE(
|
||||
QUEUE_TABLE => '${AQ_USER}.${ADDR_TABLE}',
|
||||
QUEUE_PAYLOAD_TYPE => '${AQ_USER}.${DB_OBJECT}'
|
||||
);
|
||||
DBMS_AQADM.CREATE_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}',
|
||||
QUEUE_TABLE => '${AQ_USER}.${ADDR_TABLE}'
|
||||
);
|
||||
DBMS_AQADM.START_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}'
|
||||
);
|
||||
END;
|
||||
`;
|
||||
await connection.execute(plsql);
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
async function enq() {
|
||||
let connection;
|
||||
|
||||
// The message to send.
|
||||
// The attributes correspond to the USER_ADDRESS_TYPE fields.
|
||||
const addrData = {
|
||||
|
@ -71,8 +113,8 @@ async function enq() {
|
|||
};
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
const queue = await connection.getQueue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName, {payloadType: `${AQ_USER}.${DB_OBJECT}`});
|
||||
const message = new queue.payloadTypeClass(addrData);
|
||||
console.log('Enqueuing: ', addrData);
|
||||
await queue.enqOne(message);
|
||||
|
@ -94,8 +136,8 @@ async function deq() {
|
|||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
const queue = await connection.getQueue(queueName, {payloadType: "USER_ADDRESS_TYPE"});
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName, {payloadType: `${AQ_USER}.${DB_OBJECT}`});
|
||||
const msg = await queue.deqOne(); // wait for a message
|
||||
await connection.commit();
|
||||
if (msg) {
|
||||
|
@ -114,5 +156,11 @@ async function deq() {
|
|||
}
|
||||
}
|
||||
|
||||
enq();
|
||||
deq();
|
||||
async function run() {
|
||||
await aqSetup();
|
||||
await enq();
|
||||
await deq();
|
||||
await aqUtil.dropAQtestUser(AQ_USER);
|
||||
}
|
||||
|
||||
run();
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
* DESCRIPTION
|
||||
* Oracle Advanced Queuing (AQ) example setting options and message attributes.
|
||||
*
|
||||
* Before running this, a queue allowing RAW payloads must be created, see
|
||||
* https://node-oracledb.readthedocs.io/en/latest/user_guide/aq.html#aqrawexample
|
||||
* Warning: Creates and drops a new user for running AQ operations.
|
||||
* Requires NODE_ORACLEDB_DBA_USER and NODE_ORACLE_DBA_PASSWORD env variables
|
||||
* to be set for the AQ user to be created and dropped.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -39,6 +40,7 @@ Error.stackTraceLimit = 50;
|
|||
|
||||
const oracledb = require('oracledb');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
const aqUtil = require('./aqutil.js');
|
||||
|
||||
// This example requires node-oracledb Thick mode.
|
||||
//
|
||||
|
@ -50,20 +52,52 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
const queueName = "DEMO_RAW_QUEUE";
|
||||
const RAW_TABLE = "NODB_RAW_QUEUE_TAB";
|
||||
const AQ_USER = "NODB_SCHEMA_AQTEST1";
|
||||
const AQ_USER_PWD = aqUtil.generateRandomPassword();
|
||||
|
||||
let connection;
|
||||
|
||||
const credentials = {
|
||||
user: AQ_USER,
|
||||
password: AQ_USER_PWD,
|
||||
connectString: dbConfig.connectString
|
||||
};
|
||||
|
||||
async function aqSetup() {
|
||||
await aqUtil.createAQtestUser(AQ_USER, AQ_USER_PWD);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const plsql = `
|
||||
BEGIN
|
||||
DBMS_AQADM.CREATE_QUEUE_TABLE(
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}',
|
||||
QUEUE_PAYLOAD_TYPE => 'RAW'
|
||||
);
|
||||
DBMS_AQADM.CREATE_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}',
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}'
|
||||
);
|
||||
DBMS_AQADM.START_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}'
|
||||
);
|
||||
END;
|
||||
`;
|
||||
await connection.execute(plsql);
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
async function enq() {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const queue = await connection.getQueue(queueName);
|
||||
queue.enqOptions.visibility = oracledb.AQ_VISIBILITY_IMMEDIATE; // Send a message immediately without requiring a commit
|
||||
|
@ -71,7 +105,7 @@ async function enq() {
|
|||
const messageString = 'This is my other message';
|
||||
const message = {
|
||||
payload: messageString, // the message itself
|
||||
expiration: 1 // seconds the message will remain in the queue if not dequeued
|
||||
expiration: 1 // number of seconds that the message will remain in the queue if not dequeued
|
||||
};
|
||||
console.log('Enqueuing: ' + messageString);
|
||||
await queue.enqOne(message);
|
||||
|
@ -92,7 +126,7 @@ async function deq() {
|
|||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const queue = await connection.getQueue(queueName);
|
||||
Object.assign(
|
||||
|
@ -122,5 +156,11 @@ async function deq() {
|
|||
}
|
||||
}
|
||||
|
||||
enq();
|
||||
deq();
|
||||
async function run() {
|
||||
await aqSetup();
|
||||
await enq();
|
||||
await deq();
|
||||
await aqUtil.dropAQtestUser(AQ_USER);
|
||||
}
|
||||
|
||||
run();
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
* DESCRIPTION
|
||||
* Basic Oracle Advanced Queuing (AQ) example passing text messages.
|
||||
*
|
||||
* Before running this, a queue allowing RAW payloads must be created, see
|
||||
* https://node-oracledb.readthedocs.io/en/latest/user_guide/aq.html#aqrawexample
|
||||
* Warning: Creates and drops a new user for running AQ operations.
|
||||
* Requires NODE_ORACLEDB_DBA_USER and NODE_ORACLE_DBA_PASSWORD env variables
|
||||
* to be set for the AQ user to be created and dropped.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -39,6 +40,7 @@ Error.stackTraceLimit = 50;
|
|||
|
||||
const oracledb = require('oracledb');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
const aqUtil = require('./aqutil.js');
|
||||
|
||||
// This example requires node-oracledb Thick mode.
|
||||
//
|
||||
|
@ -50,20 +52,52 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
const queueName = "DEMO_RAW_QUEUE";
|
||||
const RAW_TABLE = "NODB_RAW_QUEUE_TAB";
|
||||
const AQ_USER = "NODB_SCHEMA_AQTEST1";
|
||||
const AQ_USER_PWD = aqUtil.generateRandomPassword();
|
||||
|
||||
let connection;
|
||||
|
||||
const credentials = {
|
||||
user: AQ_USER,
|
||||
password: AQ_USER_PWD,
|
||||
connectString: dbConfig.connectString
|
||||
};
|
||||
|
||||
async function aqSetup() {
|
||||
await aqUtil.createAQtestUser(AQ_USER, AQ_USER_PWD);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
|
||||
const plsql = `
|
||||
BEGIN
|
||||
DBMS_AQADM.CREATE_QUEUE_TABLE(
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}',
|
||||
QUEUE_PAYLOAD_TYPE => 'RAW'
|
||||
);
|
||||
DBMS_AQADM.CREATE_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}',
|
||||
QUEUE_TABLE => '${AQ_USER}.${RAW_TABLE}'
|
||||
);
|
||||
DBMS_AQADM.START_QUEUE(
|
||||
QUEUE_NAME => '${AQ_USER}.${queueName}'
|
||||
);
|
||||
END;
|
||||
`;
|
||||
await connection.execute(plsql);
|
||||
await connection.close();
|
||||
}
|
||||
|
||||
async function enq() {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName);
|
||||
const messageString = 'This is my message';
|
||||
console.log('Enqueuing: ' + messageString);
|
||||
|
@ -86,7 +120,7 @@ async function deq() {
|
|||
let connection;
|
||||
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
connection = await oracledb.getConnection(credentials);
|
||||
const queue = await connection.getQueue(queueName);
|
||||
const msg = await queue.deqOne(); // wait for a message
|
||||
await connection.commit();
|
||||
|
@ -106,5 +140,11 @@ async function deq() {
|
|||
}
|
||||
}
|
||||
|
||||
enq();
|
||||
deq();
|
||||
async function run() {
|
||||
await aqSetup();
|
||||
await enq();
|
||||
await deq();
|
||||
await aqUtil.dropAQtestUser(AQ_USER);
|
||||
}
|
||||
|
||||
run();
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* Copyright (c) 2023, Oracle and/or its affiliates. */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This software is dual-licensed to you under the Universal Permissive License
|
||||
* (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
||||
* 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
||||
* either license.
|
||||
*
|
||||
* If you elect to accept the software under the Apache License, Version 2.0,
|
||||
* the following applies:
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* NAME
|
||||
* aqsetup.js
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Setup the user credentials for all the Advanced Queuing (AQ) examples.
|
||||
*
|
||||
*****************************************************************************/
|
||||
'use strict';
|
||||
|
||||
const oracledb = require('oracledb');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
|
||||
const aqUtil = exports;
|
||||
module.exports = aqUtil;
|
||||
|
||||
aqUtil.createAQtestUser = async function(AQ_USER, AQ_USER_PWD) {
|
||||
|
||||
const dbaCredential = {
|
||||
user: dbConfig.DBA_user,
|
||||
password: dbConfig.DBA_password,
|
||||
connectString: dbConfig.connectString,
|
||||
privilege: oracledb.SYSDBA
|
||||
};
|
||||
|
||||
const plsql = `
|
||||
BEGIN
|
||||
DECLARE
|
||||
e_user_missing EXCEPTION;
|
||||
PRAGMA EXCEPTION_INIT(e_user_missing, -01918);
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE('DROP USER ${AQ_USER} CASCADE');
|
||||
EXCEPTION
|
||||
WHEN e_user_missing
|
||||
THEN NULL;
|
||||
END;
|
||||
EXECUTE IMMEDIATE ('
|
||||
CREATE USER ${AQ_USER} IDENTIFIED BY ${AQ_USER_PWD}
|
||||
');
|
||||
EXECUTE IMMEDIATE ('
|
||||
GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO ${AQ_USER}
|
||||
');
|
||||
EXECUTE IMMEDIATE ('
|
||||
GRANT AQ_ADMINISTRATOR_ROLE, AQ_USER_ROLE TO ${AQ_USER}
|
||||
');
|
||||
EXECUTE IMMEDIATE ('
|
||||
GRANT EXECUTE ON DBMS_AQ TO ${AQ_USER}
|
||||
');
|
||||
END;
|
||||
`;
|
||||
|
||||
const connAsDBA = await oracledb.getConnection(dbaCredential);
|
||||
await connAsDBA.execute(plsql);
|
||||
await connAsDBA.close();
|
||||
|
||||
};
|
||||
|
||||
aqUtil.dropAQtestUser = async function(AQ_USER) {
|
||||
const dbaCredential = {
|
||||
user: dbConfig.DBA_user,
|
||||
password: dbConfig.DBA_password,
|
||||
connectString: dbConfig.connectString,
|
||||
privilege: oracledb.SYSDBA
|
||||
};
|
||||
|
||||
const connAsDBA = await oracledb.getConnection(dbaCredential);
|
||||
const sql = `DROP USER ${AQ_USER} CASCADE`;
|
||||
await connAsDBA.execute(sql);
|
||||
await connAsDBA.close();
|
||||
|
||||
};
|
||||
|
||||
aqUtil.generateRandomPassword = function(length = 6) {
|
||||
let result = "";
|
||||
const choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += choices.charAt(Math.floor(Math.random() * choices.length));
|
||||
}
|
||||
return result;
|
||||
};
|
|
@ -57,14 +57,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const httpPort = 7000;
|
||||
|
||||
// Main entry point. Creates a connection pool which becomes the
|
||||
|
|
|
@ -56,18 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
if (oracledb.oracleClientVersion < 1800000000) {
|
||||
throw new Error("Oracle Client libraries must be 18c or later");
|
||||
}
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const dboptime = 4; // seconds the simulated database operation will take
|
||||
const timeout = 2; // seconds the application will wait for the database operation
|
||||
|
||||
|
|
|
@ -53,14 +53,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
|
|
@ -73,14 +73,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
// Create a connection pool which will later be accessed via the
|
||||
|
|
|
@ -56,10 +56,10 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
@ -103,9 +103,9 @@ function myCallback(message) {
|
|||
}
|
||||
|
||||
const options = {
|
||||
callback : myCallback,
|
||||
callback: myCallback,
|
||||
sql: `SELECT * FROM no_cqntable WHERE k > :bv`,
|
||||
binds: { bv : 100 },
|
||||
binds: { bv: 100 },
|
||||
timeout: 60, // stop after 60 seconds
|
||||
clientInitiated: true, // for Oracle Database & Client 19.4 or later
|
||||
// ipAddress: '127.0.0.1', // where Node.js runs (when not using clientInitiated)
|
||||
|
|
|
@ -58,10 +58,10 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
@ -100,18 +100,18 @@ function myCallback(message) {
|
|||
}
|
||||
|
||||
const options = {
|
||||
callback : myCallback,
|
||||
callback: myCallback,
|
||||
sql: "SELECT * FROM no_cqntable",
|
||||
// ipAddress: '127.0.0.1',
|
||||
// Stop after 60 seconds
|
||||
timeout : 60,
|
||||
timeout: 60,
|
||||
// Return ROWIDs in the notification message
|
||||
qos : oracledb.SUBSCR_QOS_ROWIDS,
|
||||
qo: oracledb.SUBSCR_QOS_ROWIDS,
|
||||
// Group notifications in batches covering 10 second
|
||||
// intervals, and send a summary
|
||||
groupingClass : oracledb.SUBSCR_GROUPING_CLASS_TIME,
|
||||
groupingValue : 10,
|
||||
groupingType : oracledb.SUBSCR_GROUPING_TYPE_SUMMARY
|
||||
groupingClass: oracledb.SUBSCR_GROUPING_CLASS_TIME,
|
||||
groupingValue: 10,
|
||||
groupingType: oracledb.SUBSCR_GROUPING_TYPE_SUMMARY
|
||||
};
|
||||
|
||||
async function setup(connection) {
|
||||
|
|
|
@ -58,10 +58,10 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
// clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ async function run() {
|
|||
console.log(result.rows);
|
||||
|
||||
// Show the queried dates are of type Date
|
||||
let ts = result.rows[0]['TIMESTAMPCOL'];
|
||||
const ts = result.rows[0]['TIMESTAMPCOL'];
|
||||
ts.setDate(ts.getDate() + 5);
|
||||
console.log('TIMESTAMP manipulation in JavaScript:', ts);
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
// clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
|
|
@ -90,6 +90,10 @@ const config = {
|
|||
externalAuth: process.env.NODE_ORACLEDB_EXTERNALAUTH ? true : false,
|
||||
};
|
||||
|
||||
// Set the NODE_ORACLEDB_WALLET_LOCATION and NODE_ORACLEDB_WALLET_PASSWORD
|
||||
// environment variables for database connections that require wallets.
|
||||
// For example, creating and dropping a user.
|
||||
// See the README.md file in this directory for more details.
|
||||
if (process.env.NODE_ORACLEDB_WALLET_PASSWORD) {
|
||||
config.walletPassword = process.env.NODE_ORACLEDB_WALLET_PASSWORD;
|
||||
}
|
||||
|
@ -98,4 +102,16 @@ if (process.env.NODE_ORACLEDB_WALLET_LOCATION) {
|
|||
config.walletLocation = process.env.NODE_ORACLEDB_WALLET_LOCATION;
|
||||
}
|
||||
|
||||
// Set the NODE_ORACLEDB_DBA_USER and NODE_ORACLEDB_DBA_PASSWORD environment
|
||||
// variables for database operations which require SYSDBA privileges.
|
||||
// For example, creating and dropping a user. See the README.md file in this
|
||||
// directory for more details.
|
||||
if (process.env.NODE_ORACLEDB_DBA_USER) {
|
||||
config.DBA_user = process.env.NODE_ORACLEDB_DBA_USER;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ORACLEDB_DBA_PASSWORD) {
|
||||
config.DBA_password = process.env.NODE_ORACLEDB_DBA_PASSWORD;
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -105,11 +107,11 @@ async function run() {
|
|||
const result = await connection.execute(
|
||||
sql,
|
||||
{
|
||||
id1: 1001,
|
||||
id2: 1002,
|
||||
name: "Chris",
|
||||
ids: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
rids: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
|
||||
id1: 1001,
|
||||
id2: 1002,
|
||||
name: "Chris",
|
||||
ids: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
rids: { type: oracledb.STRING, dir: oracledb.BIND_OUT }
|
||||
},
|
||||
{ autoCommit: true }
|
||||
);
|
||||
|
|
|
@ -55,14 +55,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "INSERT INTO no_em_childtab VALUES (:1, :2, :3)";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "INSERT INTO no_em_tab VALUES (:1, :2) RETURNING ROWID, id, val INTO :3, :4, :5";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const insertSql = "INSERT INTO no_em_tab VALUES (:1, :2)";
|
||||
|
||||
const insertData = [
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "INSERT INTO no_em_tab values (:a, :b)";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "INSERT INTO no_em_tab values (:1, :2)";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -54,14 +54,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "BEGIN no_em_proc(:1, :2, :3); END;";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const sql = "DELETE FROM no_em_childtab WHERE parentid = :1";
|
||||
|
||||
const binds = [
|
||||
|
|
|
@ -56,14 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
|
|
@ -54,14 +54,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -56,10 +56,10 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
@ -68,6 +68,8 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
}
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;
|
||||
|
||||
async function run() {
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -93,7 +95,7 @@ async function run() {
|
|||
// 'bind by name' syntax
|
||||
let result = await connection.execute(
|
||||
`INSERT INTO no_tab1 VALUES (:id, :nm)`,
|
||||
{ id : {val: 1 }, nm : {val: 'Chris'} }
|
||||
{ id: {val: 1 }, nm: {val: 'Chris'} }
|
||||
);
|
||||
console.log("Rows inserted: " + result.rowsAffected); // 1
|
||||
console.log("ROWID of new row: " + result.lastRowid);
|
||||
|
|
|
@ -56,14 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection1, connection2;
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -94,8 +96,8 @@ async function run() {
|
|||
const result = await connection.execute(
|
||||
sql,
|
||||
{
|
||||
id: 1000,
|
||||
name: "Chris"
|
||||
id: 1000,
|
||||
name: "Chris"
|
||||
},
|
||||
{ autoCommit: true }
|
||||
);
|
||||
|
|
|
@ -57,14 +57,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const clobOutFileName1 = 'lobbindsout1.txt';
|
||||
const clobOutFileName2 = 'lobbindsout2.txt';
|
||||
|
||||
|
|
|
@ -60,14 +60,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
oracledb.autoCommit = true; // for ease of demonstration only
|
||||
|
||||
const clobInFileName = 'clobexample.txt'; // the file with text to be inserted into the database
|
||||
|
|
|
@ -54,14 +54,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const inFileName = 'clobexample.txt'; // the file with text to be inserted into the database
|
||||
|
||||
async function run() {
|
||||
|
|
|
@ -56,14 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const inFileName = 'clobexample.txt'; // the file with text to be inserted into the database
|
||||
|
||||
async function run() {
|
||||
|
@ -77,7 +79,7 @@ async function run() {
|
|||
|
||||
// Write into a temporary LOB.
|
||||
// An alternative would be to stream into it.
|
||||
let tempLob = await connection.createLob(oracledb.CLOB);
|
||||
const tempLob = await connection.createLob(oracledb.CLOB);
|
||||
const data = fs.readFileSync(inFileName, 'utf8');
|
||||
tempLob.write(data);
|
||||
tempLob.write("That's all!");
|
||||
|
|
|
@ -56,14 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const inFileName = 'clobexample.txt'; // the file with text to be inserted into the database
|
||||
|
||||
async function run() {
|
||||
|
|
|
@ -55,14 +55,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const blobOutFileName = 'lobselectout.jpg'; // file to write the BLOB to
|
||||
|
||||
// force all queried CLOBs to be returned as Strings
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// Stream a LOB to a file
|
||||
async function doStream(lob, outFileName) {
|
||||
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
@ -70,7 +72,7 @@ async function run() {
|
|||
//
|
||||
// Fetch a CLOB and write to the console
|
||||
//
|
||||
let result = await connection.execute(`SELECT c FROM no_lobs WHERE id = 1`);
|
||||
const result = await connection.execute(`SELECT c FROM no_lobs WHERE id = 1`);
|
||||
if (result.rows.length === 0) {
|
||||
throw new Error("No row found");
|
||||
}
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// Fetch each row as an object
|
||||
oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;
|
||||
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -69,7 +71,7 @@ async function run() {
|
|||
await demoSetup.setupBf(connection); // create the demo table
|
||||
|
||||
console.log('Query metadata');
|
||||
let result = await connection.execute(
|
||||
const result = await connection.execute(
|
||||
`SELECT id, farmer, picked
|
||||
FROM no_banana_farmer`);
|
||||
console.dir(result.metaData, { depth: null });
|
||||
|
|
|
@ -54,14 +54,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -140,11 +142,11 @@ async function run() {
|
|||
END;`,
|
||||
{
|
||||
beach_in:
|
||||
{ type : oracledb.STRING,
|
||||
{ type: oracledb.STRING,
|
||||
dir: oracledb.BIND_IN,
|
||||
val: ["Malibu Beach", "Bondi Beach", "Waikiki Beach"] },
|
||||
depth_in:
|
||||
{ type : oracledb.NUMBER,
|
||||
{ type: oracledb.NUMBER,
|
||||
dir: oracledb.BIND_IN,
|
||||
val: [45, 30, 67] }
|
||||
}
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -89,9 +91,9 @@ async function run() {
|
|||
:ret := no_func(:p1, :p2, :p3);
|
||||
END;`,
|
||||
{
|
||||
p1: 'Chris', // Bind type is determined from the data. Default direction is BIND_IN
|
||||
p2: 'Jones',
|
||||
p3: { dir: oracledb.BIND_OUT, type: oracledb.NUMBER },
|
||||
p1: 'Chris', // Bind type is determined from the data. Default direction is BIND_IN.
|
||||
p2: 'Jones',
|
||||
p3: { dir: oracledb.BIND_OUT, type: oracledb.NUMBER },
|
||||
ret: { dir: oracledb.BIND_OUT, type: oracledb.STRING, maxSize: 40 }
|
||||
});
|
||||
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -89,9 +91,9 @@ async function run() {
|
|||
no_proc(:i, :io, :o);
|
||||
END;`,
|
||||
{
|
||||
i: 'Chris', // Bind type is determined from the data. Default direction is BIND_IN
|
||||
i: 'Chris', // Bind type is determined from the data. Default direction is BIND_IN
|
||||
io: { val: 'Jones', dir: oracledb.BIND_INOUT },
|
||||
o: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
o: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection, binds, options, result, obj;
|
||||
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -92,7 +94,7 @@ async function run() {
|
|||
const inBuf = Buffer.from(data);
|
||||
let result = await connection.execute(
|
||||
`INSERT INTO no_raw VALUES (:r)`,
|
||||
{ r : { val: inBuf, type: oracledb.BUFFER, dir:oracledb.BIND_IN }});
|
||||
{ r: { val: inBuf, type: oracledb.BUFFER, dir: oracledb.BIND_IN }});
|
||||
console.log(result.rowsAffected + " row(s) inserted.");
|
||||
|
||||
//
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -98,7 +100,7 @@ async function run() {
|
|||
no_get_rs(:maxid, :cursor);
|
||||
END;`,
|
||||
{
|
||||
maxid: 3,
|
||||
maxid: 3,
|
||||
cursor: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||
});
|
||||
|
||||
|
@ -127,7 +129,7 @@ async function run() {
|
|||
CONNECT BY LEVEL <= :nr;
|
||||
END;`,
|
||||
{
|
||||
nr: 23, // number of rows to fetch
|
||||
nr: 23, // number of rows to fetch
|
||||
cursor: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||
});
|
||||
|
||||
|
|
|
@ -53,14 +53,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// Number of rows to return from each call to getRows()
|
||||
const numRows = 2;
|
||||
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -57,14 +57,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const myoffset = 1; // number of rows to skip
|
||||
const mymaxnumrows = 2; // number of rows to fetch
|
||||
|
||||
|
|
|
@ -55,14 +55,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
|
|
@ -52,14 +52,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// Oracledb properties are applicable to all connections and SQL
|
||||
// executions. They can also be set or overridden at the individual
|
||||
// execute() call level
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// If each object's attributes are accessed multiple times, it may be more
|
||||
// efficient to fetch as simple JavaScriptobjects.
|
||||
// oracledb.dbObjectAsPojo = true;
|
||||
|
|
|
@ -53,14 +53,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -150,7 +152,7 @@ async function run() {
|
|||
`SELECT JSON_OBJECT('key' IS d.dummy) dummy
|
||||
FROM dual d`
|
||||
);
|
||||
for (let row of result.rows) {
|
||||
for (const row of result.rows) {
|
||||
console.log('Query results: ', row[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,14 +56,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
|
||||
let connection;
|
||||
|
@ -107,7 +109,7 @@ async function run() {
|
|||
|
||||
console.log('3. Selecting JSON stored in a BLOB column');
|
||||
|
||||
let result, j;
|
||||
let result;
|
||||
|
||||
result = await connection.execute(
|
||||
`SELECT po_document
|
||||
|
@ -116,7 +118,7 @@ async function run() {
|
|||
OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY`
|
||||
);
|
||||
const d = await result.rows[0][0].getData();
|
||||
j = await JSON.parse(d);
|
||||
const j = await JSON.parse(d);
|
||||
console.log('Query results: ', j);
|
||||
|
||||
console.log('4. Using JSON_VALUE to extract a value from a JSON column');
|
||||
|
@ -145,7 +147,7 @@ async function run() {
|
|||
`SELECT JSON_OBJECT('key' IS d.dummy) dummy
|
||||
FROM dual d`
|
||||
);
|
||||
for (let row of result.rows) {
|
||||
for (const row of result.rows) {
|
||||
console.log('Query results: ', row[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// If each object's attributes are accessed multiple times, it may be more
|
||||
// efficient to fetch as simple JavaScriptobjects.
|
||||
// oracledb.dbObjectAsPojo = true;
|
||||
|
@ -132,7 +134,7 @@ async function run() {
|
|||
const farm1 = new FarmType(
|
||||
{
|
||||
FARMERNAME: 'MacDonald',
|
||||
HARVEST: ['Apples', 'Pears', 'Peaches']
|
||||
HARVEST: ['Apples', 'Pears', 'Peaches']
|
||||
}
|
||||
);
|
||||
console.log(farm1);
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
|
|
@ -50,14 +50,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
async function run() {
|
||||
let connection;
|
||||
|
||||
|
@ -133,7 +135,7 @@ async function run() {
|
|||
|
||||
// Query the new data back
|
||||
|
||||
let result = await connection.execute(
|
||||
const result = await connection.execute(
|
||||
`SELECT sportname, team FROM no_sports`,
|
||||
[],
|
||||
{
|
||||
|
|
|
@ -67,14 +67,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// initSession() will be invoked internally when each brand new pooled
|
||||
// connection is first used. Its callback function 'callbackFn' should be
|
||||
// invoked only when all desired session state has been set. In this example,
|
||||
|
|
|
@ -66,10 +66,10 @@ const httpPort = 7000;
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
|
|
@ -66,10 +66,10 @@ const httpPort = 7000;
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
@ -92,8 +92,8 @@ function initSession(connection, requestedTag, callbackFn) {
|
|||
console.log(`In initSession. requested tag: ${requestedTag}, actual tag: ${connection.tag}`);
|
||||
|
||||
// Split the requested and actual tags into property components
|
||||
let requestedProperties = [];
|
||||
let actualProperties = [];
|
||||
const requestedProperties = [];
|
||||
const actualProperties = [];
|
||||
if (requestedTag) {
|
||||
requestedTag.split(";").map(y => y.split("=")).forEach(e => {
|
||||
if (e[0]) requestedProperties[e[0]] = e[1];
|
||||
|
@ -109,7 +109,7 @@ function initSession(connection, requestedTag, callbackFn) {
|
|||
// correctly; these are retained in requestedProperties. Also
|
||||
// record the final, complete set of properties the connection will
|
||||
// have; these are retained in actualProperties.
|
||||
for (let k in requestedProperties) {
|
||||
for (const k in requestedProperties) {
|
||||
if (actualProperties[k] && actualProperties[k] === requestedProperties[k]) {
|
||||
delete requestedProperties[k]; // already set correctly
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@ function initSession(connection, requestedTag, callbackFn) {
|
|||
// injection issues. Construct a string of valid options usable by
|
||||
// ALTER SESSION.
|
||||
let s = "";
|
||||
for (let k in requestedProperties) {
|
||||
for (const k in requestedProperties) {
|
||||
if (k === 'TIME_ZONE') {
|
||||
switch (requestedProperties[k]) {
|
||||
case 'Australia/Melbourne':
|
||||
|
@ -148,7 +148,7 @@ function initSession(connection, requestedTag, callbackFn) {
|
|||
// Store the tag representing the connection's full set of
|
||||
// properties
|
||||
connection.tag = "";
|
||||
for (let k in actualProperties) {
|
||||
for (const k in actualProperties) {
|
||||
connection.tag += `${k}=${actualProperties[k]};`;
|
||||
}
|
||||
callbackFn(err);
|
||||
|
|
|
@ -51,10 +51,10 @@ const dbConfig = require('./dbconfig.js');
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
|
||||
|
@ -83,7 +83,7 @@ async function run() {
|
|||
// Refer to the documentation.
|
||||
const md = {
|
||||
"keyColumn": {
|
||||
"name":"ID"
|
||||
"name": "ID"
|
||||
},
|
||||
"contentColumn": {
|
||||
"name": "JSON_DOCUMENT",
|
||||
|
@ -168,7 +168,7 @@ async function run() {
|
|||
} finally {
|
||||
if (collection) {
|
||||
// Drop the collection
|
||||
let res = await collection.drop();
|
||||
const res = await collection.drop();
|
||||
if (res.dropped) {
|
||||
console.log('Collection was dropped');
|
||||
}
|
||||
|
|
|
@ -51,14 +51,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// The fetch type handler is called once per column in the SELECT list.
|
||||
// If the metadata name & type tests are satified, then the returned
|
||||
// converter function is enabled for that column. Data in this column will
|
||||
|
|
|
@ -53,14 +53,15 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
// This fetch type handler is called once per column in the SELECT list of
|
||||
// example 1. If the metadata name & type tests are satified, then the
|
||||
|
|
|
@ -50,15 +50,14 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
|
||||
// Get the database version and check the driver mode
|
||||
async function run() {
|
||||
|
||||
|
|
|
@ -74,14 +74,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|||
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
||||
// installation documentation.
|
||||
let clientOpts = {};
|
||||
if (process.platform === 'win32') { // Windows
|
||||
clientOpts = { libDir: 'C:\\oracle\\instantclient_19_17' };
|
||||
} else if (process.platform === 'darwin' && process.arch === 'x64') { // macOS Intel
|
||||
clientOpts = { libDir: process.env.HOME + '/Downloads/instantclient_19_8' };
|
||||
// On Windows and macOS Intel platforms, set the environment
|
||||
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
||||
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
||||
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
||||
}
|
||||
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
||||
}
|
||||
|
||||
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
||||
|
||||
const httpPort = 7000;
|
||||
|
||||
// If additionally using Database Resident Connection Pooling (DRCP), then set a connection class:
|
||||
|
|
|
@ -461,7 +461,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
await connection.execute(proc_drop_7415);
|
||||
}); // 75.1.22
|
||||
|
||||
it('75.1.23 named binging, bind out maxSize smaller than string length ( < 32K )', async function() {
|
||||
it('75.1.23 named binding, bind out maxSize smaller than string length ( < 32K )', async function() {
|
||||
const len = 300;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "75.1.23";
|
||||
|
@ -493,7 +493,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
);
|
||||
}); // 75.1.24
|
||||
|
||||
it('75.1.25 named binging, bind out maxSize smaller than string length ( > 64K )', async function() {
|
||||
it('75.1.25 named binding, bind out maxSize smaller than string length ( > 64K )', async function() {
|
||||
const len = 50000;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "75.1.25";
|
||||
|
@ -509,7 +509,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
);
|
||||
}); // 75.1.25
|
||||
|
||||
it('75.1.26 positional binging, bind out maxSize smaller than string length ( < 32K )', async function() {
|
||||
it('75.1.26 positional binding, bind out maxSize smaller than string length ( < 32K )', async function() {
|
||||
const len = 500;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "75.1.26";
|
||||
|
@ -523,7 +523,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
);
|
||||
}); // 75.1.26
|
||||
|
||||
it('75.1.27 positional binging, bind out maxSize smaller than string length ( > 32K )', async function() {
|
||||
it('75.1.27 positional binding, bind out maxSize smaller than string length ( > 32K )', async function() {
|
||||
const len = 50000;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "75.1.27";
|
||||
|
@ -537,7 +537,7 @@ describe('75. clobPlsqlBindAsString_bindout.js', function() {
|
|||
);
|
||||
}); // 75.1.27
|
||||
|
||||
it('75.1.28 positional binging, bind out maxSize smaller than string length ( > 64K )', async function() {
|
||||
it('75.1.28 positional binding, bind out maxSize smaller than string length ( > 64K )', async function() {
|
||||
const len = 65539;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "75.1.28";
|
||||
|
|
|
@ -630,7 +630,7 @@ describe('290. dbObject20.js', () => {
|
|||
|
||||
assert.strictEqual(result.rows[0][0], seq);
|
||||
assert.strictEqual(result.rows[0][1]['ID'], objData.ID);
|
||||
assert.deepEqual(result.rows[0][1]['NAME'], objData.NAME);
|
||||
assert.deepStrictEqual(result.rows[0][1]['NAME'], objData.NAME);
|
||||
}); // 290.3.1
|
||||
|
||||
it('290.3.2 insert an object with null string values', async () => {
|
||||
|
@ -715,7 +715,7 @@ describe('290. dbObject20.js', () => {
|
|||
|
||||
assert.strictEqual(result.rows[0].NUM, seq);
|
||||
assert.strictEqual(result.rows[0].PERSON['ID'], objData.ID);
|
||||
assert.deepEqual(result.rows[0].PERSON.NAME, objData.NAME);
|
||||
assert.deepStrictEqual(result.rows[0].PERSON.NAME, objData.NAME);
|
||||
}); // 290.3.5
|
||||
|
||||
it('290.3.6 insert multiple rows using executeMany() with inferred data type', async () => {
|
||||
|
@ -757,7 +757,7 @@ describe('290. dbObject20.js', () => {
|
|||
for (let j = 0; j < objDataArray.length; j++) {
|
||||
assert.strictEqual(result.rows[j][0], (initialSeq + j));
|
||||
assert.strictEqual(result.rows[j][1]['ID'], objDataArray[j].ID);
|
||||
assert.deepEqual(result.rows[j][1].NAME, objDataArray[j].NAME);
|
||||
assert.deepStrictEqual(result.rows[j][1].NAME, objDataArray[j].NAME);
|
||||
}
|
||||
}); // 290.3.6
|
||||
|
||||
|
@ -803,7 +803,7 @@ describe('290. dbObject20.js', () => {
|
|||
for (let j = 0; j < objDataArray.length; j++) {
|
||||
assert.strictEqual(result.rows[j][0], (initialSeq + j));
|
||||
assert.strictEqual(result.rows[j][1]['ID'], objDataArray[j].ID);
|
||||
assert.deepEqual(result.rows[j][1].NAME, objDataArray[j].NAME);
|
||||
assert.deepStrictEqual(result.rows[j][1].NAME, objDataArray[j].NAME);
|
||||
}
|
||||
}); // 290.3.7
|
||||
|
||||
|
@ -846,7 +846,7 @@ describe('290. dbObject20.js', () => {
|
|||
|
||||
assert.strictEqual(result.rows[0][0], seq);
|
||||
assert.strictEqual(result.rows[0][1]['ID'], objData.ID);
|
||||
assert.deepEqual(result.rows[0][1]['NAME'], objData.NAME);
|
||||
assert.deepStrictEqual(result.rows[0][1]['NAME'], objData.NAME);
|
||||
}); // 290.3.9
|
||||
|
||||
it('290.3.10 insert an object with buffer value with size 100', async () => {
|
||||
|
|
|
@ -86,7 +86,7 @@ describe('291. dbSchema.js', function() {
|
|||
'second annotation', ANNO_3: ''};
|
||||
|
||||
const result = await connection.execute(sql);
|
||||
assert.deepEqual(result.rows[0], [1, 25]);
|
||||
assert.deepStrictEqual(result.rows[0], [1, 25]);
|
||||
assert.strictEqual(result.metaData[0].domainSchema, undefined);
|
||||
assert.strictEqual(result.metaData[0].domainName, undefined);
|
||||
assert.strictEqual(result.metaData[0].annotations, undefined);
|
||||
|
@ -94,7 +94,7 @@ describe('291. dbSchema.js', function() {
|
|||
dbConfig.user.toUpperCase());
|
||||
assert.strictEqual(result.metaData[1].domainName,
|
||||
DOMAIN_NAME);
|
||||
assert.deepEqual(result.metaData[1].annotations,
|
||||
assert.deepStrictEqual(result.metaData[1].annotations,
|
||||
expectedAnnotations);
|
||||
}); // 291.1.1
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ describe('271. fetchTypeHandler.js', function() {
|
|||
"TS_NUM": { type: oracledb.STRING }
|
||||
}
|
||||
});
|
||||
assert.deepEqual(result.rows[0].TS_DATE, new Date('1999-12-01 11:10:01.001'));
|
||||
assert.deepStrictEqual(result.rows[0].TS_DATE, new Date('1999-12-01 11:10:01.001'));
|
||||
assert.strictEqual(typeof result.rows[0].TS_NUM, 'number');
|
||||
assert.strictEqual(result.rows[0].TS_NUM, 1234567);
|
||||
});
|
||||
|
@ -201,7 +201,7 @@ describe('271. fetchTypeHandler.js', function() {
|
|||
"TS_NUM": { type: oracledb.STRING }
|
||||
}
|
||||
});
|
||||
assert.deepEqual(result.rows[0].TS_DATE, new Date('1999-12-01 11:10:01.001'));
|
||||
assert.deepStrictEqual(result.rows[0].TS_DATE, new Date('1999-12-01 11:10:01.001'));
|
||||
assert.strictEqual(typeof result.rows[0].TS_NUM, 'string');
|
||||
assert.strictEqual(result.rows[0].TS_NUM, '1234567');
|
||||
});
|
||||
|
@ -292,7 +292,7 @@ describe('271. fetchTypeHandler.js', function() {
|
|||
const result = await connection.execute(sql);
|
||||
|
||||
assert.strictEqual(result.metaData[0].name, 'MyId');
|
||||
assert.deepEqual(result.rows, [ [ '000000005', 6, 'A string' ] ]);
|
||||
assert.deepStrictEqual(result.rows, [ [ '000000005', 6, 'A string' ] ]);
|
||||
});
|
||||
|
||||
it('271.17 converting dates to use the requested locale-specific format', async function() {
|
||||
|
@ -476,12 +476,12 @@ describe('271. fetchTypeHandler.js', function() {
|
|||
}
|
||||
);
|
||||
|
||||
assert.deepEqual(Object.getOwnPropertyNames(result.rows[0]),
|
||||
assert.deepStrictEqual(Object.getOwnPropertyNames(result.rows[0]),
|
||||
["ID", "NAME", "AGE", "TS_DATE"]);
|
||||
assert.deepEqual(result.rows[0].ID, "1");
|
||||
assert.deepEqual(result.rows[0].NAME, "ABC");
|
||||
assert.deepEqual(result.rows[0].AGE, "23");
|
||||
assert.deepEqual(result.rows[0].TS_DATE, new Date('2023-04-27 10:30:00.000'));
|
||||
assert.deepStrictEqual(result.rows[0].ID, "1");
|
||||
assert.deepStrictEqual(result.rows[0].NAME, "ABC");
|
||||
assert.deepStrictEqual(result.rows[0].AGE, "23");
|
||||
assert.deepStrictEqual(result.rows[0].TS_DATE, new Date('2023-04-27 10:30:00.000'));
|
||||
await connection.execute(testsUtil.sqlDropTable(TABLE));
|
||||
});
|
||||
|
||||
|
|
|
@ -513,9 +513,9 @@ describe('273. jsonDualityView2.js', function() {
|
|||
await conn.execute(`COMMIT`);
|
||||
let result = await conn.execute(`select * from redact order by 1`);
|
||||
assert.strictEqual(result.rows.length, 3);
|
||||
assert.deepEqual(result.rows[0], [1, "ABC", 1234123412341234]);
|
||||
assert.deepEqual(result.rows[1], [2, "LMN", 2345234523452345]);
|
||||
assert.deepEqual(result.rows[2], [3, "XYZ", 3456345634563456]);
|
||||
assert.deepStrictEqual(result.rows[0], [1, "ABC", 1234123412341234]);
|
||||
assert.deepStrictEqual(result.rows[1], [2, "LMN", 2345234523452345]);
|
||||
assert.deepStrictEqual(result.rows[2], [3, "XYZ", 3456345634563456]);
|
||||
await conn.close();
|
||||
|
||||
await dbaConn.execute(`begin
|
||||
|
@ -536,9 +536,9 @@ describe('273. jsonDualityView2.js', function() {
|
|||
result = await conn.execute(`select * from redact order by 1`);
|
||||
|
||||
assert.strictEqual(result.rows.length, 3);
|
||||
assert.deepEqual(result.rows[0], [1, "ABC", 0]);
|
||||
assert.deepEqual(result.rows[1], [2, "LMN", 0]);
|
||||
assert.deepEqual(result.rows[2], [3, "XYZ", 0]);
|
||||
assert.deepStrictEqual(result.rows[0], [1, "ABC", 0]);
|
||||
assert.deepStrictEqual(result.rows[1], [2, "LMN", 0]);
|
||||
assert.deepStrictEqual(result.rows[2], [3, "XYZ", 0]);
|
||||
await assert.rejects(
|
||||
async () => await conn.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov1
|
||||
AS redact
|
||||
|
|
|
@ -250,7 +250,7 @@ describe('274 jsonDualityView3.js', function() {
|
|||
FROM student_ov
|
||||
ORDER BY 1 ASC
|
||||
`);
|
||||
assert.deepEqual(result1.rows, [[1], [2], [3]]);
|
||||
assert.deepStrictEqual(result1.rows, [[1], [2], [3]]);
|
||||
|
||||
// select StudentId from student_ov ordered by ascending values
|
||||
const result2 = await connection.execute(`
|
||||
|
@ -258,7 +258,7 @@ describe('274 jsonDualityView3.js', function() {
|
|||
FROM student_ov
|
||||
ORDER BY 1 ASC
|
||||
`);
|
||||
assert.deepEqual(result2.rows, [['ABC'], ['LMN'], ['XYZ']]);
|
||||
assert.deepStrictEqual(result2.rows, [['ABC'], ['LMN'], ['XYZ']]);
|
||||
await connection.execute(`drop table student1 PURGE`);
|
||||
});
|
||||
|
||||
|
@ -332,7 +332,7 @@ describe('274 jsonDualityView3.js', function() {
|
|||
FROM student_ov
|
||||
ORDER BY 1 ASC
|
||||
`);
|
||||
assert.deepEqual(result.rows, [[1], [2], [3]]);
|
||||
assert.deepStrictEqual(result.rows, [[1], [2], [3]]);
|
||||
await connection.execute(`drop table student PURGE`);
|
||||
await connection.execute(`drop view student_ov`);
|
||||
});
|
||||
|
|
|
@ -178,7 +178,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
|
||||
const result = await connection.execute(`select * from Persons`);
|
||||
|
||||
assert.deepEqual(result.rows[0], [13, "ABC", "XYZ"]);
|
||||
assert.deepStrictEqual(result.rows[0], [13, "ABC", "XYZ"]);
|
||||
|
||||
// DROP the tables
|
||||
await connection.execute(`DROP TABLE Persons`);
|
||||
|
@ -307,7 +307,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
`);
|
||||
|
||||
assert.strictEqual(tables.rows.length, 3);
|
||||
assert.deepEqual(tables.rows, [["CLASS"], ["STUDENT"], ["STUDENT_CLASS"]]);
|
||||
assert.deepStrictEqual(tables.rows, [["CLASS"], ["STUDENT"], ["STUDENT_CLASS"]]);
|
||||
|
||||
// display user views
|
||||
const views = await connection.execute(`
|
||||
|
@ -326,7 +326,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
ORDER BY 1
|
||||
`);
|
||||
|
||||
assert.deepEqual(studentOV.rows[0], ["STUDENT_OV"]);
|
||||
assert.deepStrictEqual(studentOV.rows[0], ["STUDENT_OV"]);
|
||||
});
|
||||
|
||||
it('275.6 Test with dictionary views', async function() {
|
||||
|
@ -348,7 +348,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM DBA_JSON_DUALITY_VIEW_TAB_COLS
|
||||
ORDER BY COLUMN_NAME`);
|
||||
assert.strictEqual(result.rows.length, 7);
|
||||
assert.deepEqual(result.rows[0], [ 'CLSID', 'NUMBER' ]);
|
||||
assert.deepStrictEqual(result.rows[0], [ 'CLSID', 'NUMBER' ]);
|
||||
});
|
||||
|
||||
describe('275.7 Json Duality view with GraphQL', function() {
|
||||
|
@ -761,7 +761,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
ORDER BY 1 ASC
|
||||
`);
|
||||
|
||||
assert.deepEqual(result1.rows, [[1], [4], [8], [9], [12], [19], [81]]);
|
||||
assert.deepStrictEqual(result1.rows, [[1], [4], [8], [9], [12], [19], [81]]);
|
||||
|
||||
// select StudentId from student_ov ordered by ascending values
|
||||
const result2 = await connection.execute(`
|
||||
|
@ -769,7 +769,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM student_ov s
|
||||
ORDER BY 1 ASC
|
||||
`);
|
||||
assert.deepEqual(result2.rows, [[1], [4], [8], [9], [12], [19], [81]]);
|
||||
assert.deepStrictEqual(result2.rows, [[1], [4], [8], [9], [12], [19], [81]]);
|
||||
|
||||
// select StudentId from student_ov ordered by descending values
|
||||
const result3 = await connection.execute(`
|
||||
|
@ -777,7 +777,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM student_ov
|
||||
ORDER BY 1 DESC
|
||||
`);
|
||||
assert.deepEqual(result3.rows, [[81], [19], [12], [9], [8], [4], [1]]);
|
||||
assert.deepStrictEqual(result3.rows, [[81], [19], [12], [9], [8], [4], [1]]);
|
||||
|
||||
// select StudentId from student_ov ordered by descending values
|
||||
const result4 = await connection.execute(`
|
||||
|
@ -785,7 +785,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM student_ov s
|
||||
ORDER BY 1 DESC
|
||||
`);
|
||||
assert.deepEqual(result4.rows, [[81], [19], [12], [9], [8], [4], [1]]);
|
||||
assert.deepStrictEqual(result4.rows, [[81], [19], [12], [9], [8], [4], [1]]);
|
||||
|
||||
// select StudentName from student_ov ordered by descending values
|
||||
const result5 = await connection.execute(`
|
||||
|
@ -793,7 +793,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM student_ov
|
||||
ORDER BY 1 DESC
|
||||
`);
|
||||
assert.deepEqual(result5.rows, [['H'], ['F'], ['E'], ['D'], ['C'], ['B'], ['A']]);
|
||||
assert.deepStrictEqual(result5.rows, [['H'], ['F'], ['E'], ['D'], ['C'], ['B'], ['A']]);
|
||||
|
||||
// select StudentName from student_ov ordered by descending values
|
||||
const result6 = await connection.execute(`
|
||||
|
@ -801,7 +801,7 @@ describe('275. jsonDualityView4.js', function() {
|
|||
FROM student_ov s
|
||||
ORDER BY 1 DESC
|
||||
`);
|
||||
assert.deepEqual(result6.rows, [['H'], ['F'], ['E'], ['D'], ['C'], ['B'], ['A']]);
|
||||
assert.deepStrictEqual(result6.rows, [['H'], ['F'], ['E'], ['D'], ['C'], ['B'], ['A']]);
|
||||
|
||||
// select StudentName and StudentId from student_ov ordered by StudentName descending and StudentId ascending
|
||||
const result7 = 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.deepEqual(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]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -649,7 +649,7 @@ annotation or NOUPDATE annotation specified.*/
|
|||
`);
|
||||
|
||||
const result = await connection.execute(`select s.data.StudentName."NULL" from student_ov s`);
|
||||
assert.deepEqual(result.rows, [["ABC"], ["LMN"], ["XYZ"]]);
|
||||
assert.deepStrictEqual(result.rows, [["ABC"], ["LMN"], ["XYZ"]]);
|
||||
await connection.execute(`
|
||||
CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov
|
||||
AS
|
||||
|
|
|
@ -149,7 +149,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.deepEqual(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}]);
|
||||
});
|
||||
|
||||
it('277.1.2 Sanity DMLs', async function() {
|
||||
|
@ -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.deepEqual(result.rows[0][0].student_class, [{"student_class_id": 3, "student_id": 3}]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[1], [2], [3]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [['Ajit'], ['Shashank'], ['Tirthankar']]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[3], [2]]);
|
||||
assert.Strict(result.rows, [[3], [2]]);
|
||||
|
||||
result = await connection.execute(`select o.data.StudentClass from student_ov o
|
||||
order by o.data desc`);
|
||||
assert.deepEqual(result.rows[0][0], [{"StudentClassId": 3, "StudentId": 3}]);
|
||||
assert.deepEqual(result.rows[1][0], [{"StudentClassId": 2, "StudentId": 2}]);
|
||||
assert.deepEqual(result.rows[2][0], [{"StudentClassId": 1, "StudentId": 1}]);
|
||||
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}]);
|
||||
|
||||
result = await connection.execute(`select o.data.StudentClass.StudentId,o.data.StudentId from student_ov o
|
||||
order by 1`);
|
||||
assert.deepEqual(result.rows, [[1, 1], [2, 2], [3, 3]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[1], [3]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[3], [2], [1]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[2, "Tirthankar"]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[3, 3]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[3], [1]]);
|
||||
assert.Strict(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.deepEqual(result.rows, [[3]]);
|
||||
assert.Strict(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.deepEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1,
|
||||
assert.Strict(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.deepEqual(result.rows[0][0]._id, {"stuid": 1});
|
||||
assert.Strict(result.rows[0][0]._id, {"stuid": 1});
|
||||
assert.strictEqual(result.rows[0][0].StudentName, "Ajit");
|
||||
assert.deepEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
|
||||
assert.Strict(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.deepEqual(result.rows[0][0].StudentId, 1);
|
||||
assert.Strict(result.rows[0][0].StudentId, 1);
|
||||
assert.strictEqual(result.rows[0][0].StudentName, "Ajit");
|
||||
assert.deepEqual(result.rows[0][0].StudentClass, [{"StudentClassId": 1, "StudentId": 1,
|
||||
assert.Strict(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
|
||||
|
|
|
@ -1350,12 +1350,12 @@ Overview of node-oracledb functional tests
|
|||
75.1.20 mixing named with positional binding
|
||||
75.1.21 works with UPDATE
|
||||
75.1.22 works with substr
|
||||
75.1.23 named binging, bind out maxSize smaller than string length ( < 32K )
|
||||
75.1.24 named binging, bind out maxSize smaller than string length ( > 32K )
|
||||
75.1.25 named binging, bind out maxSize smaller than string length ( > 64K )
|
||||
75.1.26 positional binging, bind out maxSize smaller than string length ( < 32K )
|
||||
75.1.27 positional binging, bind out maxSize smaller than string length ( > 32K )
|
||||
75.1.28 positional binging, bind out maxSize smaller than string length ( > 63K )
|
||||
75.1.23 named binding, bind out maxSize smaller than string length ( < 32K )
|
||||
75.1.24 named binding, bind out maxSize smaller than string length ( > 32K )
|
||||
75.1.25 named binding, bind out maxSize smaller than string length ( > 64K )
|
||||
75.1.26 positional binding, bind out maxSize smaller than string length ( < 32K )
|
||||
75.1.27 positional binding, bind out maxSize smaller than string length ( > 32K )
|
||||
75.1.28 positional binding, bind out maxSize smaller than string length ( > 63K )
|
||||
75.2 CLOB, PLSQL, BIND_OUT to VARCHAR2
|
||||
75.2.1 works with EMPTY_LOB
|
||||
75.2.2 works with EMPTY_LOB and bind out maxSize set to 1
|
||||
|
|
|
@ -63,10 +63,10 @@ describe('280. pipelinedTables.js', function() {
|
|||
END pkg1;`);
|
||||
|
||||
let result = await connection.execute(`SELECT * FROM TABLE (pkg1.f1(5))`);
|
||||
assert.deepEqual(result.rows, [[1], [2], [3], [4], [5]]);
|
||||
assert.deepStrictEqual(result.rows, [[1], [2], [3], [4], [5]]);
|
||||
|
||||
result = await connection.execute(`SELECT * FROM TABLE (pkg1.f1(2))`);
|
||||
assert.deepEqual(result.rows, [[1], [2]]);
|
||||
assert.deepStrictEqual(result.rows, [[1], [2]]);
|
||||
});
|
||||
|
||||
it('280.2 Invoking Pipelined Table Function with invalid syntax', async function() {
|
||||
|
@ -109,7 +109,7 @@ describe('280. pipelinedTables.js', function() {
|
|||
|
||||
// call the table function
|
||||
let result = await connection.execute(`SELECT COLUMN_VALUE my_string FROM TABLE (strings ())`);
|
||||
assert.deepEqual(result.rows, [['abc']]);
|
||||
assert.deepStrictEqual(result.rows, [['abc']]);
|
||||
|
||||
// create a pipelined version of that same table function
|
||||
await connection.execute(`CREATE OR REPLACE FUNCTION strings_pl
|
||||
|
@ -148,7 +148,7 @@ describe('280. pipelinedTables.js', function() {
|
|||
FROM TABLE(get_tab_ptf(10))
|
||||
ORDER BY id DESC`);
|
||||
|
||||
assert.deepEqual(result.rows, [[10, "Description for 10"],
|
||||
assert.deepStrictEqual(result.rows, [[10, "Description for 10"],
|
||||
[9, "Description for 9"],
|
||||
[8, "Description for 8"],
|
||||
[7, "Description for 7"],
|
||||
|
@ -184,7 +184,7 @@ describe('280. pipelinedTables.js', function() {
|
|||
|
||||
await connection.commit();
|
||||
const result = await connection.execute(`SELECT country_code, count(*) FROM parallel_test GROUP BY country_code ORDER BY country_code ASC`);
|
||||
assert.deepEqual(result.rows, [["IN", 25000], ["UK", 25000], ["US", 50000]]);
|
||||
assert.deepStrictEqual(result.rows, [["IN", 25000], ["UK", 25000], ["US", 50000]]);
|
||||
await connection.execute(`drop table parallel_test PURGE`);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue