fix(mysql): ignore routine labels in compatible dialects
This commit is contained in:
2 files changed
+65
-1
No files matched your search
@@ -670,6 +670,69 @@ SELECT @value AS Message;`;
|
||||
expect(executeCurrentSql).toHaveBeenCalledWith(sql, {});
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
label: "JDBC MySQL",
|
||||
config: {
|
||||
...connection("jdbc"),
|
||||
driver_label: "MySQL JDBC",
|
||||
connection_string: "jdbc:mysql://127.0.0.1:3306/app",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "GBase MySQL compatibility",
|
||||
config: {
|
||||
...connection("gbase"),
|
||||
driver_profile: "gbase",
|
||||
driver_label: "GBase 8a",
|
||||
},
|
||||
},
|
||||
])("executes $label cursor procedures from the gutter without opening the parameter dialog", async ({ config }) => {
|
||||
const sql = `CREATE PROCEDURE process_orders()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE order_id INT;
|
||||
DECLARE cur_orders CURSOR FOR SELECT id FROM orders;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
OPEN cur_orders;
|
||||
read_loop:LOOP
|
||||
FETCH cur_orders INTO order_id;
|
||||
IF done THEN LEAVE read_loop; END IF;
|
||||
END LOOP read_loop;
|
||||
CLOSE cur_orders;
|
||||
END`;
|
||||
const activeTab = ref<QueryTab | undefined>({ ...queryTab("app"), sql });
|
||||
const activeConnection = ref<ConnectionConfig | undefined>(config);
|
||||
const activeOutputView = ref<"result" | "summary" | "explain" | "chart">("result");
|
||||
const queryStore = useQueryStore();
|
||||
const executeCurrentSql = vi.spyOn(queryStore, "executeCurrentSql").mockImplementation(async () => {
|
||||
if (activeTab.value) activeTab.value.result = { columns: [], rows: [], affected_rows: 0, execution_time_ms: 1 };
|
||||
});
|
||||
vi.spyOn(useHistoryStore(), "add").mockResolvedValue(undefined);
|
||||
vi.spyOn(useConnectionStore(), "refreshObjectListTreeNode").mockResolvedValue(undefined);
|
||||
|
||||
const execution = useSqlExecution({
|
||||
activeTab: computed(() => activeTab.value),
|
||||
activeConnection: computed(() => activeConnection.value),
|
||||
executableSql: computed(() => sql),
|
||||
resolveExecutableSql: async () => sql,
|
||||
activeOutputView,
|
||||
});
|
||||
|
||||
await execution.tryExecute({
|
||||
fullSql: sql,
|
||||
selectedSql: sql,
|
||||
cursorPos: 0,
|
||||
selectionFrom: 0,
|
||||
selectionTo: sql.length,
|
||||
editorViewportRequestId: 1,
|
||||
});
|
||||
|
||||
expect(execution.showSqlParameterDialog.value).toBe(false);
|
||||
expect(execution.sqlParameterNames.value).toEqual([]);
|
||||
expect(executeCurrentSql).toHaveBeenCalledWith(sql, { sourceOffset: 0, onExecutionStarted: expect.any(Function) });
|
||||
});
|
||||
|
||||
it("sends Doris STRUCT DDL unchanged without opening the parameter dialog", async () => {
|
||||
const sql = `
|
||||
create table \`events\` (
|
||||
|
||||
Reference in new issue
Block a user