fix(query): default query tabs to auto-commit
This commit is contained in:
4 files changed
+12
-15
No files matched your search
@@ -115,11 +115,8 @@ describe("supportsTransaction", () => {
|
||||
});
|
||||
|
||||
describe("defaultAutoCommitForDbType", () => {
|
||||
it("defaults Oracle query tabs to manual transactions", () => {
|
||||
expect(defaultAutoCommitForDbType("oracle")).toBe(false);
|
||||
});
|
||||
|
||||
it("defaults other databases to auto-commit", () => {
|
||||
it("defaults query tabs to auto-commit", () => {
|
||||
expect(defaultAutoCommitForDbType("oracle")).toBe(true);
|
||||
expect(defaultAutoCommitForDbType("mysql")).toBe(true);
|
||||
expect(defaultAutoCommitForDbType("postgres")).toBe(true);
|
||||
expect(defaultAutoCommitForDbType("dameng")).toBe(true);
|
||||
|
||||
@@ -250,8 +250,8 @@ export function supportsTransaction(dbType?: string): boolean {
|
||||
|
||||
/**
|
||||
* Default auto-commit mode when opening a query tab for the given database type.
|
||||
* Oracle defaults to manual transactions so edits require an explicit Commit.
|
||||
* Query tabs default to auto-commit; users can explicitly switch to manual transactions.
|
||||
*/
|
||||
export function defaultAutoCommitForDbType(dbType?: string): boolean {
|
||||
return dbType !== "oracle";
|
||||
export function defaultAutoCommitForDbType(_dbType?: string): boolean {
|
||||
return true;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "ORCL", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
|
||||
await store.executeTabSql(tabId, "SELECT t.* FROM SH_SMCVDMS_OVERSEAS_DRSSITB.TT_PLATFORM_CARS t WHERE t.PLATFORM = '轻卡'");
|
||||
@@ -673,7 +673,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "ORCL", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
|
||||
await store.executeTabSql(tabId, "SELECT * FROM aa");
|
||||
@@ -750,7 +750,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "ORCL", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
|
||||
const execution = store.executeTabSql(tabId, "SELECT t.* FROM APP.WIDE_TABLE t");
|
||||
@@ -901,7 +901,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "ORCL", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
|
||||
await store.executeTabSql(tabId, sql);
|
||||
@@ -950,7 +950,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "ORCL", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
|
||||
@@ -1251,7 +1251,7 @@ describe("queryStore hidden primary key editing", () => {
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("oracle-1", "XEPDB1", "Query");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabId, true);
|
||||
|
||||
await store.executeTabSql(tabId, "SELECT NAME FROM DBX_HIDDEN_PK_EDIT_TEST");
|
||||
|
||||
@@ -534,7 +534,7 @@ describe("queryStore multi-statement errors", () => {
|
||||
const store = useQueryStore();
|
||||
const tabA = store.createTab("oracle-1", "ORCL", "Tab A");
|
||||
const tabB = store.createTab("oracle-1", "ORCL", "Tab B");
|
||||
// Exercise auto-commit execute-multi path (Oracle tabs default to manual TX).
|
||||
// Exercise the explicit auto-commit execute-multi path.
|
||||
store.setAutoCommit(tabA, true);
|
||||
store.setAutoCommit(tabB, true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user