forked from CITKParus/P8-ExchangeService
Установка наименования подуля в сессии при подключении к БД
This commit is contained in:
parent
d26b0d49c8
commit
d98fd1046a
@ -15,7 +15,9 @@ let dbConnect = {
|
|||||||
password: "parus",
|
password: "parus",
|
||||||
//Строка подключения к БД
|
//Строка подключения к БД
|
||||||
connectString: "DEMOP_CITKSERV_WAN",
|
connectString: "DEMOP_CITKSERV_WAN",
|
||||||
//Модуль обслуживания БД
|
//Наименование модуля (для сессии БД)
|
||||||
|
moduleName: "PARUS$ExchangeServer",
|
||||||
|
//Подключаемый модуль обслуживания БД (низкоуровневые функции работы с СУБД)
|
||||||
module: "parus_oracle_db.js"
|
module: "parus_oracle_db.js"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ class DBConnector {
|
|||||||
this.connection = await this.connector.connect(
|
this.connection = await this.connector.connect(
|
||||||
this.connectSettings.user,
|
this.connectSettings.user,
|
||||||
this.connectSettings.password,
|
this.connectSettings.password,
|
||||||
this.connectSettings.connectString
|
this.connectSettings.connectString,
|
||||||
|
this.connectSettings.moduleName
|
||||||
);
|
);
|
||||||
return this.connection;
|
return this.connection;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
16
index.js
16
index.js
@ -35,13 +35,15 @@ try {
|
|||||||
a.putLog(db.MSG_TYPE_INF, "Сервер приложений подключен")
|
a.putLog(db.MSG_TYPE_INF, "Сервер приложений подключен")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
a.disconnect()
|
setTimeout(() => {
|
||||||
.then(res => {
|
a.disconnect()
|
||||||
console.log("DISCONNECTED");
|
.then(res => {
|
||||||
})
|
console.log("DISCONNECTED");
|
||||||
.catch(e => {
|
})
|
||||||
console.log(e.code + ": " + e.message);
|
.catch(e => {
|
||||||
});
|
console.log(e.code + ": " + e.message);
|
||||||
|
});
|
||||||
|
}, 10000);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
console.log(e.code + ": " + e.message);
|
console.log(e.code + ": " + e.message);
|
||||||
|
@ -38,13 +38,14 @@ const SLOG_STATE_ERR = "ERR"; //Ошибка (строковый код)
|
|||||||
//------------
|
//------------
|
||||||
|
|
||||||
//Подключение к БД
|
//Подключение к БД
|
||||||
const connect = async (user, password, connectString) => {
|
const connect = async (user, password, connectString, moduleName) => {
|
||||||
try {
|
try {
|
||||||
const conn = await oracledb.getConnection({
|
const conn = await oracledb.getConnection({
|
||||||
user,
|
user,
|
||||||
password,
|
password,
|
||||||
connectString
|
connectString
|
||||||
});
|
});
|
||||||
|
conn.module = moduleName;
|
||||||
return conn;
|
return conn;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e.message);
|
throw new Error(e.message);
|
||||||
@ -174,9 +175,10 @@ const getQueueOutgoing = (connection, portionSize) => {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
connection.execute(
|
connection.execute(
|
||||||
"BEGIN PKG_EXS.QUEUE_OUT_GET(NPORTION => :NPORTION, RCQUEUES => :RCQUEUES); END;",
|
"BEGIN PKG_EXS.QUEUE_GET(NPORTION => :NPORTION, NSRV_TYPE => :NSRV_TYPE, RCQUEUES => :RCQUEUES); END;",
|
||||||
{
|
{
|
||||||
NPORTION: portionSize,
|
NPORTION: portionSize,
|
||||||
|
NSRV_TYPE: NSRV_TYPE_SEND,
|
||||||
RCQUEUES: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
RCQUEUES: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
},
|
},
|
||||||
{ outFormat: oracledb.OBJECT, autoCommit: true, fetchInfo: { BMSG: { type: oracledb.BUFFER } } },
|
{ outFormat: oracledb.OBJECT, autoCommit: true, fetchInfo: { BMSG: { type: oracledb.BUFFER } } },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user