mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 19:13:59 +00:00
SYNC: autocommit for Oracle
This commit is contained in:
committed by
Diflow
parent
11d193a6dd
commit
9e9dec5389
@@ -66,6 +66,9 @@ module.exports = {
|
||||
if (session.loadingReader_jslid) {
|
||||
socket.emit(`session-jslid-done-${session.loadingReader_jslid}`);
|
||||
}
|
||||
if (props.autoCommit) {
|
||||
this.executeControlCommand({ sesid, command: 'commitTransaction' });
|
||||
}
|
||||
if (session.killOnDone) {
|
||||
this.kill({ sesid });
|
||||
}
|
||||
@@ -135,7 +138,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
executeQuery_meta: true,
|
||||
async executeQuery({ sesid, sql }) {
|
||||
async executeQuery({ sesid, sql, autoCommit }) {
|
||||
const session = this.opened.find(x => x.sesid == sesid);
|
||||
if (!session) {
|
||||
throw new Error('Invalid session');
|
||||
@@ -143,7 +146,7 @@ module.exports = {
|
||||
|
||||
logger.info({ sesid, sql }, 'Processing query');
|
||||
this.dispatchMessage(sesid, 'Query execution started');
|
||||
session.subprocess.send({ msgtype: 'executeQuery', sql });
|
||||
session.subprocess.send({ msgtype: 'executeQuery', sql, autoCommit });
|
||||
|
||||
return { state: 'ok' };
|
||||
},
|
||||
|
||||
@@ -285,7 +285,7 @@ async function handleExecuteControlCommand({ command }) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleExecuteQuery({ sql }) {
|
||||
async function handleExecuteQuery({ sql, autoCommit }) {
|
||||
lastActivity = new Date().getTime();
|
||||
|
||||
await waitConnected();
|
||||
@@ -319,7 +319,7 @@ async function handleExecuteQuery({ sql }) {
|
||||
// handler.stream = stream;
|
||||
// resultIndex = handler.resultIndex;
|
||||
}
|
||||
process.send({ msgtype: 'done' });
|
||||
process.send({ msgtype: 'done', autoCommit });
|
||||
} finally {
|
||||
executingScripts--;
|
||||
}
|
||||
|
||||
@@ -339,9 +339,13 @@
|
||||
sesid = resp.sesid;
|
||||
sessionId = sesid;
|
||||
}
|
||||
if (driver?.implicitTransactions) {
|
||||
isInTransaction = true;
|
||||
}
|
||||
await apiCall('sessions/execute-query', {
|
||||
sesid,
|
||||
sql,
|
||||
autoCommit: driver?.implicitTransactions && isAutocommit,
|
||||
});
|
||||
await apiCall('query-history/write', {
|
||||
data: {
|
||||
@@ -463,7 +467,7 @@
|
||||
}
|
||||
|
||||
export function endTransactionEnabled() {
|
||||
return !!sessionId && driver?.supportsTransactions && isInTransaction && !busy;
|
||||
return !!sessionId && driver?.supportsTransactions && isInTransaction && !busy && !isAutocommit;
|
||||
}
|
||||
|
||||
export function autocommitOffSwitch() {
|
||||
@@ -493,6 +497,9 @@
|
||||
|
||||
const handleSessionDone = () => {
|
||||
busy = false;
|
||||
if (isAutocommit) {
|
||||
isInTransaction = false;
|
||||
}
|
||||
timerLabel.stop();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user