fix(desktop): open streaming sql executor for oversized sql files

Closes #8100
This commit is contained in:
t8y2 committed 2026-09-05 08:50:40 +08:00
1 parent 3be523b2f5
commit 4cc6d0959d
4 files changed
+139 -2

No files matched your search

+5 -1
View File
@@ -4,6 +4,7 @@ import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useToast } from "@/composables/useToast";
import { useLargeSqlFileStreamingFallback } from "@/composables/useLargeSqlFileFallback";
import * as api from "@/lib/backend/api";
import type { ConnectionConfig, ExternalSqlFileVersion } from "@/types/database";
import { detectDatabaseFileType } from "@/lib/database/databaseFileDetection";
@@ -23,6 +24,7 @@ export function useFileDrop() {
const connectionStore = useConnectionStore();
const queryStore = useQueryStore();
const { toast } = useToast();
const { openInStreamingExecutorOnTooLarge } = useLargeSqlFileStreamingFallback();
async function openDroppedSqlFile(name: string, content: string, path?: string, version?: ExternalSqlFileVersion) {
if (path) {
@@ -88,7 +90,9 @@ export function useFileDrop() {
const snapshot = await api.readExternalSqlFileSnapshot(path);
await openDroppedSqlFile(name, snapshot.content, path, snapshot.version);
} catch (e: any) {
toast(t("toolbar.sqlOpenFailed", { message: externalSqlFileOpenErrorMessage(e, (key, params) => t(key, params)) }), 5000);
if (!openInStreamingExecutorOnTooLarge(path, e)) {
toast(t("toolbar.sqlOpenFailed", { message: externalSqlFileOpenErrorMessage(e, (key, params) => t(key, params)) }), 5000);
}
}
continue;
}