25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { useI18n } from "vue-i18n";
import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useToast } from "@/composables/useToast";
import { resolveExternalSqlFileTargetForActiveTab } from "@/lib/sql/externalSqlFileTarget";
import { formatSqlFileSize, isExternalSqlFileTooLargeError, isSqlFilePath } from "@/lib/sql/sqlFileOpen";
/**
* Editor-oversized external SQL files are not a dead end: route them to the
* streaming Execute SQL File dialog, mirroring SqlFilePanel's fallback for
* files the editor cannot load.
*/
export function useLargeSqlFileStreamingFallback() {
const { t } = useI18n();
const connectionStore = useConnectionStore();
const queryStore = useQueryStore();
const { toast } = useToast();
function openInStreamingExecutor(path: string, sizeBytes: number) {
const target = resolveExternalSqlFileTargetForActiveTab(path, queryStore.tabs, queryStore.activeTabId, (connectionId) => connectionStore.getConfig(connectionId));
connectionStore.sqlFileSource = {
connectionId: target.connectionId,
database: target.database,
...(target.schema ? { schema: target.schema } : {}),
filePath: path,
};
toast(t("sqlFile.largeFileExecutionOpened", { size: formatSqlFileSize(sizeBytes) }), 6000);
}
function openInStreamingExecutorOnTooLarge(path: string | undefined, error: unknown): boolean {
if (!path || !isExternalSqlFileTooLargeError(error) || !isSqlFilePath(path)) return false;
openInStreamingExecutor(path, error.sizeBytes);
return true;
}
return { openInStreamingExecutor, openInStreamingExecutorOnTooLarge };
}