fix(mysql): keep select into user variables declared
This commit is contained in:
3 files changed
+91
-3
No files matched your search
@@ -843,6 +843,38 @@ SELECT @value AS Message;`;
|
||||
expect(executedSql).toContain("where fp.create_at < @date_start");
|
||||
});
|
||||
|
||||
it("sends MySQL SELECT INTO user variables without opening the parameter dialog", async () => {
|
||||
const sql = `
|
||||
select project_id,
|
||||
year(date_sub(review_date, interval 1 month)),
|
||||
month(date_sub(review_date, interval 1 month))
|
||||
into @project_id, @year, @month
|
||||
from cms_dynamic_cost_review
|
||||
where id = '9f03cb27-a553-11f1-8af2-48dc2d090a1c';
|
||||
`;
|
||||
const activeTab = ref<QueryTab | undefined>(queryTab("app"));
|
||||
const activeConnection = ref<ConnectionConfig | undefined>(connection("mysql"));
|
||||
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);
|
||||
|
||||
const execution = useSqlExecution({
|
||||
activeTab: computed(() => activeTab.value),
|
||||
activeConnection: computed(() => activeConnection.value),
|
||||
executableSql: computed(() => sql),
|
||||
activeOutputView,
|
||||
});
|
||||
|
||||
await execution.tryExecute();
|
||||
|
||||
expect(execution.showSqlParameterDialog.value).toBe(false);
|
||||
expect(execution.sqlParameterNames.value).toEqual([]);
|
||||
expect(executeCurrentSql).toHaveBeenCalledWith(sql, {});
|
||||
});
|
||||
|
||||
it("executes MySQL cursor procedures with compact labels without opening the parameter dialog", async () => {
|
||||
const sql = `
|
||||
CREATE PROCEDURE process_orders()
|
||||
|
||||
Reference in new issue
Block a user