fix(editor): 修复SQL快捷执行导致执行全量SQL的问题 (#2384)
- 将执行SQL语句的逻辑从直接请求改为通过事件发射 - 增强了代码的可扩展性和可维护性
This commit is contained in:
4 files changed
+40
-1
No files matched your search
@@ -18,6 +18,15 @@ describe("executableStatementRangeCacheForDoc", () => {
|
||||
expect(executableStatementRangeStartingAt(second, 10)?.sql).toBe("SELECT 2");
|
||||
});
|
||||
|
||||
it("resolves the exact multi-line statement for a gutter run button", () => {
|
||||
const doc = Text.of(["SELECT *", "FROM apis AS ap", "LIMIT 100;", "", "SELECT *", "FROM menus AS mn", "LIMIT 100;"]);
|
||||
|
||||
const cache = executableStatementRangeCacheForDoc(null, doc, "mysql");
|
||||
const secondStatementLine = doc.line(5);
|
||||
|
||||
expect(executableStatementRangeStartingAt(cache, secondStatementLine.from)?.sql).toBe("SELECT *\nFROM menus AS mn\nLIMIT 100");
|
||||
});
|
||||
|
||||
it("rebuilds the cache when the document instance changes", () => {
|
||||
const firstDoc = Text.of(["SELECT 1;"]);
|
||||
const secondDoc = Text.of(["SELECT 1;"]);
|
||||
|
||||
Reference in new issue
Block a user