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