fix(editor): apply default transaction mode when binding unbound tabs
This commit is contained in:
1 parent
1137cab7f4
commit
0459dfea12
2 files changed
+37
-3
No files matched your search
@@ -4261,10 +4261,14 @@ export const useQueryStore = defineStore("query", () => {
|
||||
if (tab.oracleTxnPossiblyDirty !== undefined) tab.oracleTxnPossiblyDirty = false;
|
||||
}
|
||||
|
||||
function rollbackTabTransaction(tab: QueryTab, options?: { resetAutoCommit?: boolean }) {
|
||||
function rollbackTabTransaction(tab: QueryTab, options?: { resetAutoCommit?: boolean; resetAutoCommitDbType?: string }) {
|
||||
if (tab.txnSessionId) void rollbackTransaction(tab.id);
|
||||
if (options?.resetAutoCommit) {
|
||||
const dbType = useConnectionStore().getConfig(tab.connectionId)?.db_type;
|
||||
// Callers switching a tab to another connection pass the target db type
|
||||
// explicitly: the tab still carries the previous connectionId at reset
|
||||
// time, and unbound file/saved-SQL tabs have none at all (which would
|
||||
// force auto-commit even when the default mode is manual, #8863).
|
||||
const dbType = options.resetAutoCommitDbType ?? useConnectionStore().getConfig(tab.connectionId)?.db_type;
|
||||
tab.autoCommit = defaultAutoCommitForDbTypeWithSetting(dbType);
|
||||
}
|
||||
clearOracleTxnPossiblyDirty(tab);
|
||||
@@ -4608,7 +4612,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
function updateConnection(id: string, connectionId: string, database = "", options: UpdateExecutionTargetOptions = {}) {
|
||||
const tab = tabs.value.find((t) => t.id === id);
|
||||
if (!tab || tab.connectionId === connectionId) return;
|
||||
rollbackTabTransaction(tab, { resetAutoCommit: true });
|
||||
rollbackTabTransaction(tab, { resetAutoCommit: true, resetAutoCommitDbType: useConnectionStore().getConfig(connectionId)?.db_type });
|
||||
void closeResultSession(tab);
|
||||
void closeClientConnectionSession(tab);
|
||||
tab.connectionId = connectionId;
|
||||
|
||||
Reference in new issue
Block a user