feat(editor): add toggle for SQL identifier quoting

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-07 01:11:42 +08:00
1 parent 14e1d4f25b
commit 2eaf7f9914
23 files changed
+125 -23

No files matched your search

@@ -208,6 +208,10 @@ describe("buildSelectAllSql", () => {
expect(buildSelectAllSql("postgres", { schema: "public", tableName: "users" })).toBe('SELECT * FROM "public"."users"');
});
it("can omit identifier quotes while preserving schema qualification", () => {
expect(buildSelectAllSql("postgres", { schema: "public", tableName: "users" }, undefined, undefined, false, false)).toBe("SELECT * FROM public.users");
});
it("preserves the Phoenix schema for new-query prefill", () => {
expect(buildSelectAllSql("jdbc", { schema: "APP", tableName: "USERS" }, '"', "phoenix")).toBe('SELECT * FROM "APP"."USERS"');
});
@@ -280,6 +284,19 @@ describe("resolveNewQueryInitialSql", () => {
).toBe('SELECT * FROM "public"."users"');
});
it("omits identifier quotes when configured for new-query prefill", () => {
expect(
resolveNewQueryInitialSql({
activeTab: dataTab(),
prefillEnabled: true,
targetConnectionId: "conn-1",
targetDatabase: "app_db",
databaseType: "postgres",
quoteIdentifiers: false,
}),
).toBe("SELECT * FROM public.users");
});
it("passes the Phoenix driver profile into the initial SQL builder", () => {
expect(
resolveNewQueryInitialSql({
@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { buildTableSelectTemplate } from "@/lib/table/tableSqlTemplates";
describe("buildTableSelectTemplate", () => {
it("can omit identifier quotes for a new-query table reference", () => {
expect(
buildTableSelectTemplate({
databaseType: "postgres",
schema: "public",
tableName: "dbx_smoke",
quoteIdentifiers: false,
}),
).toBe("SELECT *\nFROM public.dbx_smoke;");
});
});