Refactor tests
This commit is contained in:
parent
81cf2df5a4
commit
9a9958e5ce
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2015, 2022, Oracle and/or its affiliates. */
|
||||
/* Copyright (c) 2015, 2023, Oracle and/or its affiliates. */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
@ -95,30 +95,22 @@ describe('7. autoCommit.js', function() {
|
|||
// get another connection
|
||||
conn2 = await pool.getConnection();
|
||||
|
||||
try {
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 82);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
}
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 82);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
|
||||
await conn1.execute(
|
||||
"UPDATE nodb_commit_dept SET department_id = 101 WHERE department_name = 'Security'");
|
||||
|
||||
try {
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 101);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
}
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 101);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
|
||||
await conn1.release();
|
||||
await conn2.release();
|
||||
|
@ -137,30 +129,22 @@ describe('7. autoCommit.js', function() {
|
|||
|
||||
conn2 = await pool.getConnection();
|
||||
|
||||
try {
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 82);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
}
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 82);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
|
||||
await conn1.execute("UPDATE nodb_commit_dept SET department_id = 101 WHERE department_name = 'Security'");
|
||||
|
||||
|
||||
try {
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 101);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
}
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].DEPARTMENT_ID, 101);
|
||||
assert.strictEqual(typeof (result.rows[0].DEPARTMENT_ID), "number");
|
||||
|
||||
await conn1.release();
|
||||
await conn2.release();
|
||||
|
@ -178,39 +162,27 @@ describe('7. autoCommit.js', function() {
|
|||
|
||||
conn2 = await pool.getConnection();
|
||||
|
||||
try {
|
||||
oracledb.autoCommit = true; // change autoCommit after connection
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows, []);
|
||||
}
|
||||
oracledb.autoCommit = true; // change autoCommit after connection
|
||||
result = await conn2.execute(
|
||||
"SELECT department_id FROM nodb_commit_dept WHERE department_name = 'Security'",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.deepEqual(result.rows, []);
|
||||
|
||||
await conn2.execute(
|
||||
"INSERT INTO nodb_commit_dept VALUES (99, 'Marketing')");
|
||||
|
||||
try {
|
||||
result = await conn2.execute(
|
||||
"SELECT COUNT(*) as amount FROM nodb_commit_dept",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].AMOUNT, 1);
|
||||
}
|
||||
result = await conn2.execute(
|
||||
"SELECT COUNT(*) as amount FROM nodb_commit_dept",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].AMOUNT, 1);
|
||||
|
||||
try {
|
||||
result = await conn1.execute(
|
||||
"SELECT COUNT(*) as amount FROM nodb_commit_dept",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(result.rows[0].AMOUNT, 2); // autoCommit for SELECT
|
||||
}
|
||||
result = await conn1.execute(
|
||||
"SELECT COUNT(*) as amount FROM nodb_commit_dept",
|
||||
[],
|
||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT });
|
||||
assert.strictEqual(result.rows[0].AMOUNT, 2); // autoCommit for SELECT
|
||||
|
||||
await conn1.release();
|
||||
await conn2.release();
|
||||
|
@ -285,17 +257,13 @@ describe('7. autoCommit.js', function() {
|
|||
});
|
||||
|
||||
let setAsExecOption = async function(setValue) {
|
||||
let result = null;
|
||||
try {
|
||||
result = await connection.execute(
|
||||
"select user from dual",
|
||||
{},
|
||||
{ autoCommit: setValue });
|
||||
} catch (err) {
|
||||
assert.ifError(result);
|
||||
assert(err);
|
||||
assert.strictEqual(err.message, "NJS-007: invalid value for \"autoCommit\" in parameter 3");
|
||||
}
|
||||
const sql = "select user from dual";
|
||||
const binds = [];
|
||||
const options = { autoCommit: setValue };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sql, binds, options),
|
||||
/NJS-007:/
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
'use strict';
|
||||
|
||||
const oracledb = require('oracledb');
|
||||
const assert = require('assert');
|
||||
const sql = require('./sqlClone.js');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
|
||||
describe('263. binding_buffer_string.js', function() {
|
||||
|
@ -58,23 +56,13 @@ describe('263. binding_buffer_string.js', function() {
|
|||
"END; ";
|
||||
const drop_table = "DROP TABLE blob_tab PURGE";
|
||||
before('get connection and create table', async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
await sql.executeSql(connection, proc_blob_in_tab, {}, {});
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
await connection.execute(proc_blob_in_tab);
|
||||
});
|
||||
|
||||
after('release connection', async function() {
|
||||
try {
|
||||
await sql.executeSql(connection, drop_table, {}, {});
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
|
||||
await connection.execute(drop_table);
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
describe('263.1 BLOB, PLSQL, BIND_IN', function() {
|
||||
|
@ -93,9 +81,7 @@ describe('263. binding_buffer_string.js', function() {
|
|||
autoCommit: true
|
||||
};
|
||||
|
||||
const result = await connection.executeMany("insert into blob_tab (id, blob_1) values(:a, :b)", data, options);
|
||||
console.log(result.rowsAffected);
|
||||
await connection.close();
|
||||
await connection.executeMany("insert into blob_tab (id, blob_1) values(:a, :b)", data, options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,29 +42,13 @@ const dbConfig = require('./dbconfig.js');
|
|||
describe('100.binding_defaultBindIn.js', function() {
|
||||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest1 = async function(table_name, proc_name, dbColType, content) {
|
||||
|
@ -97,25 +81,19 @@ describe('100.binding_defaultBindIn.js', function() {
|
|||
"END " + proc_name + "; ";
|
||||
let sqlRun = "BEGIN " + proc_name + " (:c); END;";
|
||||
let proc_drop = "DROP PROCEDURE " + proc_name;
|
||||
try {
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(createTable);
|
||||
await connection.execute(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
await compareErrMsg(dbColType, err);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
compareErrMsg(dbColType, err);
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(proc_drop);
|
||||
await connection.execute(drop_table);
|
||||
};
|
||||
|
||||
const inBind2 = async function(table_name, fun_name, dbColType, bindVar) {
|
||||
|
@ -133,24 +111,19 @@ describe('100.binding_defaultBindIn.js', function() {
|
|||
let proc_drop = "DROP FUNCTION " + fun_name;
|
||||
// console.log(proc);
|
||||
|
||||
try {
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(createTable);
|
||||
await connection.execute(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
await compareErrMsg(dbColType, err);
|
||||
}
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
compareErrMsg(dbColType, err);
|
||||
|
||||
await connection.execute(proc_drop);
|
||||
await connection.execute(drop_table);
|
||||
};
|
||||
|
||||
let compareErrMsg = function(element, err) {
|
||||
|
|
|
@ -43,28 +43,15 @@ describe('99.binding_functionBindIn.js', function() {
|
|||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(sql);
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest = async function(table_name, procName, bindType, dbColType, content, sequence, nullBind) {
|
||||
|
@ -94,29 +81,23 @@ describe('99.binding_functionBindIn.js', function() {
|
|||
let proc_drop = "DROP FUNCTION " + fun_name;
|
||||
|
||||
// console.log(proc);
|
||||
try {
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(dbColType, err);
|
||||
}
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
};
|
||||
|
||||
let compareErrMsgForString = function(nullBind, element, err) {
|
||||
|
|
|
@ -42,29 +42,17 @@ const assist = require('./dataTypeAssist.js');
|
|||
describe('95.binding_functionBindInout.js', function() {
|
||||
|
||||
let connection = null;
|
||||
var executeSql = async function(sql) {
|
||||
try {
|
||||
const result = await connection.execute(sql);
|
||||
assert(result);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
await connection.release();
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
var doTest = async function(table_name, proc_name, bindType, dbColType, content, sequence, nullBind) {
|
||||
var bindVar = {
|
||||
const doTest = async function(table_name, proc_name, bindType, dbColType, content, sequence, nullBind) {
|
||||
let bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
c: { val: content, type: bindType, dir: oracledb.BIND_INOUT, maxSize: 1000 },
|
||||
output: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT }
|
||||
|
@ -74,10 +62,10 @@ describe('95.binding_functionBindInout.js', function() {
|
|||
await inBind(table_name, proc_name, dbColType, bindVar, bindType, nullBind);
|
||||
};
|
||||
|
||||
var inBind = async function(table_name, fun_name, dbColType, bindVar, bindType, nullBind) {
|
||||
var createTable = sql.createTable(table_name, dbColType);
|
||||
var drop_table = "DROP TABLE " + table_name + " PURGE";
|
||||
var proc = "CREATE OR REPLACE FUNCTION " + fun_name + " (ID IN NUMBER, inValue IN OUT " + dbColType + ") RETURN NUMBER\n" +
|
||||
const inBind = async function(table_name, fun_name, dbColType, bindVar, bindType, nullBind) {
|
||||
const createTable = sql.createTable(table_name, dbColType);
|
||||
const drop_table = "DROP TABLE " + table_name + " PURGE";
|
||||
const proc = "CREATE OR REPLACE FUNCTION " + fun_name + " (ID IN NUMBER, inValue IN OUT " + dbColType + ") RETURN NUMBER\n" +
|
||||
"IS \n" +
|
||||
" tmpvar NUMBER; \n" +
|
||||
"BEGIN \n" +
|
||||
|
@ -85,29 +73,29 @@ describe('95.binding_functionBindInout.js', function() {
|
|||
" select id, content into tmpvar, inValue from " + table_name + " where id = ID; \n" +
|
||||
" RETURN tmpvar; \n" +
|
||||
"END ; ";
|
||||
var sqlRun = "BEGIN :output := " + fun_name + " (:i, :c); END;";
|
||||
var proc_drop = "DROP FUNCTION " + fun_name;
|
||||
// console.log(proc);
|
||||
const sqlRun = "BEGIN :output := " + fun_name + " (:i, :c); END;";
|
||||
const proc_drop = "DROP FUNCTION " + fun_name;
|
||||
|
||||
await executeSql(createTable);
|
||||
|
||||
await executeSql(proc);
|
||||
await connection.execute(createTable);
|
||||
await connection.execute(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
await executeSql(proc_drop);
|
||||
|
||||
await executeSql(drop_table);
|
||||
await connection.execute(proc_drop);
|
||||
await connection.execute(drop_table);
|
||||
};
|
||||
|
||||
var compareErrMsgForString = function(nullBind, element, err) {
|
||||
const compareErrMsgForString = function(nullBind, element, err) {
|
||||
if (element === "BLOB") {
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PLS-00306: wrong number or types of arguments in call to 'NODB_INBIND_XX'
|
||||
|
@ -140,7 +128,7 @@ describe('95.binding_functionBindInout.js', function() {
|
|||
}
|
||||
};
|
||||
|
||||
var compareErrMsgForRAW = function(nullBind, element, err) {
|
||||
const compareErrMsgForRAW = function(nullBind, element, err) {
|
||||
if (element === "NUMBER" || element.indexOf("FLOAT") > -1 || element === "BINARY_DOUBLE" || element === "DATE" || element === "TIMESTAMP" || element === "CLOB") {
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PLS-00306: wrong number or types of arguments in call to 'NODB_INBIND_XX'
|
||||
|
@ -161,9 +149,9 @@ describe('95.binding_functionBindInout.js', function() {
|
|||
}
|
||||
};
|
||||
|
||||
var tableNamePre = "table_95";
|
||||
var procPre = "proc_95";
|
||||
var index = 1;
|
||||
const tableNamePre = "table_95";
|
||||
const procPre = "proc_95";
|
||||
let index = 1;
|
||||
|
||||
describe('95.1 PLSQL function: bind inout small value of oracledb.STRING/BUFFER', function() {
|
||||
|
||||
|
|
|
@ -43,28 +43,15 @@ describe('97.binding_functionBindOut.js', function() {
|
|||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(sql);
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest = async function(table_name, proc_name, bindType, dbColType, content, sequence, nullBind) {
|
||||
|
@ -121,42 +108,32 @@ describe('97.binding_functionBindOut.js', function() {
|
|||
};
|
||||
|
||||
// console.log(insertSql);
|
||||
try {
|
||||
await connection.execute(insertSql, bind);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(insertSql, bind);
|
||||
await executeSql(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
};
|
||||
|
||||
var compareErrMsgForString = function(element, err) {
|
||||
try {
|
||||
if (element === "BLOB") {
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PLS-00306: wrong number or types of arguments in call to 'NODB_INBIND_12'
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PL/SQL: Statement ignored
|
||||
assert.equal(err.message.substring(0, 10), "ORA-06550:");
|
||||
}
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
if (element === "BLOB") {
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PLS-00306: wrong number or types of arguments in call to 'NODB_INBIND_12'
|
||||
// ORA-06550: line 1, column 7:
|
||||
// PL/SQL: Statement ignored
|
||||
assert.equal(err.message.substring(0, 10), "ORA-06550:");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -43,28 +43,15 @@ describe('93.binding_procedureBindIn.js', function() {
|
|||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(sql);
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest = async function(table_name, proc_name, dbColType, content, bindType, nullBind) {
|
||||
|
@ -87,29 +74,23 @@ describe('93.binding_procedureBindIn.js', function() {
|
|||
let sqlRun = "BEGIN " + proc_name + " (:c); END;";
|
||||
let proc_drop = "DROP PROCEDURE " + proc_name;
|
||||
|
||||
try {
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(dbColType, err);
|
||||
}
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
};
|
||||
|
||||
let compareErrMsgForString = function(nullBind, element, err) {
|
||||
|
|
|
@ -42,29 +42,13 @@ const assist = require('./dataTypeAssist.js');
|
|||
describe('94.binding_procedureBindInout.js', function() {
|
||||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest = async function(table_name, proc_name, bindType, dbColType, content, sequence, nullBind) {
|
||||
|
@ -90,29 +74,23 @@ describe('94.binding_procedureBindInout.js', function() {
|
|||
let proc_drop = "DROP PROCEDURE " + proc_name;
|
||||
|
||||
// console.log(proc);
|
||||
try {
|
||||
await executeSql(createTable);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(createTable);
|
||||
await connection.execute(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(nullBind, dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(proc_drop);
|
||||
await connection.execute(drop_table);
|
||||
};
|
||||
|
||||
let compareErrMsgForString = function(nullBind, element, err) {
|
||||
|
|
|
@ -43,28 +43,15 @@ describe('96.binding_procedureBindOut.js', function() {
|
|||
|
||||
let connection = null;
|
||||
const executeSql = async function(sql) {
|
||||
try {
|
||||
await connection.execute(sql);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(sql);
|
||||
};
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
const doTest = async function(table_name, procName, bindType, dbColType, content, sequence, nullBind) {
|
||||
|
@ -118,29 +105,23 @@ describe('96.binding_procedureBindOut.js', function() {
|
|||
c2: { val: inserted[0], type: inserted[1], dir: oracledb.BIND_IN }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(insertSql, bind);
|
||||
await executeSql(proc);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.execute(insertSql, bind);
|
||||
await executeSql(proc);
|
||||
|
||||
let err;
|
||||
try {
|
||||
await connection.execute(sqlRun, bindVar);
|
||||
} catch (err) {
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
if (bindType === oracledb.STRING) {
|
||||
compareErrMsgForString(dbColType, err);
|
||||
} else {
|
||||
compareErrMsgForRAW(nullBind, dbColType, err);
|
||||
}
|
||||
|
||||
try {
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await executeSql(proc_drop);
|
||||
await executeSql(drop_table);
|
||||
};
|
||||
|
||||
let compareErrMsgForString = function(element, err) {
|
||||
|
|
|
@ -107,20 +107,16 @@ describe('138. blobDMLReturningMultipleRowsAsStream.js', function() {
|
|||
let updateReturning_stream = async function() {
|
||||
let sql_update = "UPDATE " + tableName + " set num = num+10 RETURNING num, blob into :num, :lobou";
|
||||
let result = null;
|
||||
try {
|
||||
result = await connection.execute(
|
||||
sql_update,
|
||||
{
|
||||
num: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
lobou: { type: oracledb.BLOB, dir: oracledb.BIND_OUT }
|
||||
});
|
||||
let numLobs = result.outBinds.lobou.length;
|
||||
assert.strictEqual(numLobs, 10);
|
||||
for (let n = 0; n < numLobs; n++) {
|
||||
verifyLob(n, result);
|
||||
}
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
result = await connection.execute(
|
||||
sql_update,
|
||||
{
|
||||
num: { type: oracledb.NUMBER, dir: oracledb.BIND_OUT },
|
||||
lobou: { type: oracledb.BLOB, dir: oracledb.BIND_OUT }
|
||||
});
|
||||
let numLobs = result.outBinds.lobou.length;
|
||||
assert.strictEqual(numLobs, 10);
|
||||
for (let n = 0; n < numLobs; n++) {
|
||||
verifyLob(n, result);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -415,12 +415,12 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
}); // 77.1.11
|
||||
|
||||
it('77.1.12 works with undefined and bind in maxSize set to (64K - 1)', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: undefined, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: 65535 }
|
||||
};
|
||||
let option = { autoCommit: true };
|
||||
const option = { autoCommit: true };
|
||||
|
||||
await plsqlBindIn(sqlRun, bindVar, option);
|
||||
|
||||
|
@ -429,39 +429,29 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
}); // 77.1.12
|
||||
|
||||
it('77.1.13 works with NaN', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: NaN, type: oracledb.BUFFER, dir: oracledb.BIND_IN }
|
||||
};
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch in parameter 2
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.1.13
|
||||
|
||||
it('77.1.14 works with 0', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: 0, type: oracledb.BUFFER, dir: oracledb.BIND_IN }
|
||||
};
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch in parameter 2
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.1.14
|
||||
|
||||
it('77.1.15 works with Buffer size 32K', async function() {
|
||||
|
@ -539,56 +529,45 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
}); // 77.1.18
|
||||
|
||||
it('77.1.19 works with bind value and type mismatch', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: 200, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: 50000 }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch in parameter 2
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.1.19
|
||||
|
||||
it('77.1.20 mixing named with positional binding', async function() {
|
||||
let size = 50000;
|
||||
let sequence = insertID++;
|
||||
let specialStr = "77.1.20";
|
||||
let bigStr = random.getRandomString(size, specialStr);
|
||||
let bufferStr = Buffer.from(bigStr, "utf-8");
|
||||
let bindVar = [ sequence, { val: bufferStr, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: size } ];
|
||||
let option = { autoCommit: true };
|
||||
const size = 50000;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "77.1.20";
|
||||
const bigStr = random.getRandomString(size, specialStr);
|
||||
const bufferStr = Buffer.from(bigStr, "utf-8");
|
||||
const bindVar = [ sequence, { val: bufferStr, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: size } ];
|
||||
const option = { autoCommit: true };
|
||||
|
||||
let sqlRun_77122 = "BEGIN nodb_blobs_in_771 (:1, :2); END;";
|
||||
const sqlRun_77122 = "BEGIN nodb_blobs_in_771 (:1, :2); END;";
|
||||
await plsqlBindIn(sqlRun_77122, bindVar, option);
|
||||
|
||||
let sql = "select blob_1 from nodb_tab_blob_in where id = " + sequence;
|
||||
const sql = "select blob_1 from nodb_tab_blob_in where id = " + sequence;
|
||||
await verifyBlobValueWithBuffer(sql, bufferStr, specialStr);
|
||||
}); // 77.1.20
|
||||
|
||||
it('77.1.21 works with invalid BLOB', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: {}, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: 50000 }
|
||||
};
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.1.21
|
||||
|
||||
it('77.1.22 works without maxSize', async function() {
|
||||
|
@ -878,41 +857,29 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
}); // 77.2.12
|
||||
|
||||
it('77.2.13 works with NaN', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: NaN, type: oracledb.BUFFER, dir: oracledb.BIND_IN }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch in parameter 2
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.2.13
|
||||
|
||||
it('77.2.14 works with 0', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: 0, type: oracledb.BUFFER, dir: oracledb.BIND_IN }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch in parameter 2
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.2.14
|
||||
|
||||
it('77.2.15 works with Buffer size (32K - 1)', async function() {
|
||||
|
@ -934,45 +901,32 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
}); // 77.2.15
|
||||
|
||||
it('77.2.16 works with Buffer size 32K', async function() {
|
||||
let size = 32768;
|
||||
let sequence = insertID++;
|
||||
let specialStr = "77.2.16";
|
||||
let bigStr = random.getRandomString(size, specialStr);
|
||||
let bufferStr = Buffer.from(bigStr, "utf-8");
|
||||
let bindVar = {
|
||||
const size = 32768;
|
||||
const sequence = insertID++;
|
||||
const specialStr = "77.2.16";
|
||||
const bigStr = random.getRandomString(size, specialStr);
|
||||
const bufferStr = Buffer.from(bigStr, "utf-8");
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: bufferStr, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: size }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar);
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// ORA-06502: PL/SQL: numeric or value error
|
||||
assert(err.message.startsWith("ORA-06502:"));
|
||||
}
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar),
|
||||
/ORA-06502:/
|
||||
);
|
||||
}); // 77.2.16
|
||||
|
||||
it('77.2.17 works with invalid BLOB', async function() {
|
||||
let sequence = insertID++;
|
||||
let bindVar = {
|
||||
const sequence = insertID++;
|
||||
const bindVar = {
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b: { val: {}, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: 50000 }
|
||||
};
|
||||
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
bindVar,
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert(err);
|
||||
// NJS-011: encountered bind value and type mismatch
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
assert(err.message.startsWith("NJS-011:"));
|
||||
}
|
||||
const options = { autoCommit: true };
|
||||
await assert.rejects(
|
||||
async () => await connection.execute(sqlRun, bindVar, options),
|
||||
/NJS-011:/
|
||||
);
|
||||
}); // 77.2.17
|
||||
|
||||
it('77.2.18 works without maxSize', async function() {
|
||||
|
@ -1106,30 +1060,22 @@ describe('77. blobPlsqlBindAsBuffer_bindin.js', function() {
|
|||
let sql = "INSERT INTO nodb_tab_lobs_in (id, blob) VALUES (:i, EMPTY_BLOB()) RETURNING blob INTO :lobbv";
|
||||
await prepareTableWithBlob(sql, preparedCLOBID);
|
||||
|
||||
try {
|
||||
result = await connection.execute(
|
||||
"select blob from nodb_tab_lobs_in where id = :id",
|
||||
{ id: preparedCLOBID });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
result = await connection.execute(
|
||||
"select blob from nodb_tab_lobs_in where id = :id",
|
||||
{ id: preparedCLOBID });
|
||||
|
||||
assert.notEqual(result.rows.length, 0);
|
||||
|
||||
let blob = result.rows[0][0];
|
||||
try {
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
{
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b1: { val: bufferStr_1, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: size_1 },
|
||||
b2: { val: blob, type: oracledb.BLOB, dir: oracledb.BIND_IN }
|
||||
},
|
||||
{ autoCommit: true });
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
blob.close();
|
||||
}
|
||||
const blob = result.rows[0][0];
|
||||
await connection.execute(
|
||||
sqlRun,
|
||||
{
|
||||
i: { val: sequence, type: oracledb.NUMBER, dir: oracledb.BIND_IN },
|
||||
b1: { val: bufferStr_1, type: oracledb.BUFFER, dir: oracledb.BIND_IN, maxSize: size_1 },
|
||||
b2: { val: blob, type: oracledb.BLOB, dir: oracledb.BIND_IN }
|
||||
},
|
||||
{ autoCommit: true });
|
||||
blob.destroy();
|
||||
|
||||
let sql_1 = "select blob_1 from nodb_tab_blob_in where id = " + sequence;
|
||||
await verifyBlobValueWithBuffer(sql_1, bufferStr_1, specialStr);
|
||||
|
|
|
@ -67,36 +67,21 @@ describe('136. clobDMLReturningMultipleRowsAsString.js', function() {
|
|||
const clob_table_drop = "DROP TABLE " + tableName + " PURGE";
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
assert(connection);
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
connection = await oracledb.getConnection(dbConfig);
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await connection.release();
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
describe('136.1 CLOB DML returning multiple rows as String', function() {
|
||||
|
||||
before(async function() {
|
||||
try {
|
||||
await sql.executeSql(connection, clob_table_create, {}, {});
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await sql.executeSql(connection, clob_table_create, {}, {});
|
||||
});
|
||||
|
||||
after(async function() {
|
||||
try {
|
||||
await sql.executeSql(connection, clob_table_drop, {}, {});
|
||||
} catch (err) {
|
||||
assert.ifError(err);
|
||||
}
|
||||
await sql.executeSql(connection, clob_table_drop, {}, {});
|
||||
});
|
||||
|
||||
it('136.1.1 CLOB DML returning multiple rows as String', async function() {
|
||||
|
@ -105,8 +90,8 @@ describe('136. clobDMLReturningMultipleRowsAsString.js', function() {
|
|||
|
||||
});
|
||||
|
||||
var updateReturning_string = async function() {
|
||||
var sql_update = "UPDATE " + tableName + " set num = num+10 RETURNING num, clob into :num, :lobou";
|
||||
const updateReturning_string = async function() {
|
||||
const sql_update = "UPDATE " + tableName + " set num = num+10 RETURNING num, clob into :num, :lobou";
|
||||
const result = await connection.execute(
|
||||
sql_update,
|
||||
{
|
||||
|
@ -116,9 +101,9 @@ describe('136. clobDMLReturningMultipleRowsAsString.js', function() {
|
|||
assert(result);
|
||||
const numLobs = result.outBinds.lobou.length;
|
||||
assert.strictEqual(numLobs, 10);
|
||||
for (var index = 0; index < result.outBinds.lobou.length; index++) {
|
||||
var lob = result.outBinds.lobou[index];
|
||||
var id = result.outBinds.num[index];
|
||||
for (let index = 0; index < result.outBinds.lobou.length; index++) {
|
||||
const lob = result.outBinds.lobou[index];
|
||||
const id = result.outBinds.num[index];
|
||||
assert.strictEqual(lob, String(id - 10));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue