fix(export): align row limits and progress

This commit is contained in:
t8y2 committed 2026-06-25 17:01:32 +08:00
1 parent c2aeaaa8f7
commit 42541d1146
15 files changed
+419 -42

No files matched your search

+8 -5
View File
@@ -2220,10 +2220,12 @@ export const useQueryStore = defineStore("query", () => {
const queryTimeoutSecs = queryTimeoutSecsForConnection(conn);
const useAgentCursor = conn?.db_type === "jdbc" || supportsDatabaseFeature(conn?.db_type, "driverManagement");
const queryBaseSql = tab.resultBaseSql ?? sql;
const exportRowLimit = useSettingsStore().editorSettings.exportRowLimit;
const exportSettings = useSettingsStore().editorSettings;
const exportRowLimit = exportSettings.exportRowLimitEnabled ? exportSettings.exportRowLimit : Number.POSITIVE_INFINITY;
const agentExportMaxRows = exportSettings.exportRowLimitEnabled ? exportSettings.exportRowLimit : 2_147_483_647;
// Use the already-computed total row count as a progress estimate so the
// export dialog shows a moving bar instead of a stuck 0 while paginating.
const totalRows = typeof tab.resultTotalRowCount === "number" ? tab.resultTotalRowCount : null;
const totalRows = typeof tab.resultTotalRowCount === "number" ? Math.min(tab.resultTotalRowCount, exportRowLimit) : null;
const pageLimit = Math.max(tab.resultPageLimit ?? 0, TABLE_DATA_EXPORT_PAGE_SIZE);
const rows: QueryResult["rows"] = [];
let columns: string[] = [];
@@ -2248,7 +2250,7 @@ export const useQueryStore = defineStore("query", () => {
if (typeof plan.pageLimit !== "number" || typeof plan.pageOffset !== "number") return tab.result;
const executionOptions = plan.useAgentResultSession
? {
maxRows: exportRowLimit,
maxRows: agentExportMaxRows,
fetchSize: plan.pageLimit,
pageSize: plan.pageLimit,
resultSessionId: sessionId,
@@ -2298,7 +2300,8 @@ export const useQueryStore = defineStore("query", () => {
if (!effectiveDbType) return undefined;
const useAgentCursor = conn?.db_type === "jdbc" || supportsDatabaseFeature(conn?.db_type, "driverManagement");
const queryBaseSql = tab.resultBaseSql ?? sql;
const totalRows = typeof tab.resultTotalRowCount === "number" ? tab.resultTotalRowCount : null;
const rowLimit = settings.exportRowLimitEnabled ? settings.exportRowLimit : null;
const totalRows = typeof tab.resultTotalRowCount === "number" ? (rowLimit === null ? tab.resultTotalRowCount : Math.min(tab.resultTotalRowCount, rowLimit)) : null;
const clientSessionId = tabClientSessionId(tab, "export");
return {
@@ -2313,7 +2316,7 @@ export const useQueryStore = defineStore("query", () => {
filePath: options.filePath,
format: options.format,
pageSize: settings.exportBatchSize,
rowLimit: settings.exportRowLimitEnabled ? settings.exportRowLimit : null,
rowLimit,
totalRows,
timeoutSecs: queryTimeoutSecsForConnection(conn),
keysetOptimizationEnabled: settings.queryExportKeysetOptimizationEnabled,
+1 -1
View File
@@ -447,7 +447,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
snippets: DEFAULT_SQL_SNIPPETS,
tableColumnTemplateFields: [...DEFAULT_TABLE_COLUMN_TEMPLATE_FIELDS],
exportBatchSize: 2000,
exportRowLimitEnabled: true,
exportRowLimitEnabled: false,
exportRowLimit: 100000,
queryExportKeysetOptimizationEnabled: true,
toolbarItems: { ...DEFAULT_TOOLBAR_ITEMS },