feat(query): display total row count in result status bar

Execute COUNT query asynchronously after main query to show total
matching rows. Strip user-supplied LIMIT/OFFSET from count SQL so
the total reflects all rows, not just the limited page.
This commit is contained in:
t8y2 committed 2026-05-28 22:44:13 +08:00
1 parent e15e99aeb5
commit 539faef23d
8 files changed
+43 -1

No files matched your search

@@ -188,6 +188,7 @@ const props = defineProps<{
pageOffset?: number;
pageLimit?: number;
countSql?: string;
totalRowCount?: number;
loading?: boolean;
cacheKey?: string;
onExecuteSql?: (sql: string) => Promise<void>;
@@ -5605,7 +5606,12 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
<!-- Bottom status bar -->
<div class="flex items-center gap-2 px-3 py-1 border-t text-xs text-muted-foreground bg-muted/30 shrink-0">
<span v-if="hasData">{{ t("grid.totalRows", { count: result.rows.length }) }}</span>
<span v-if="hasData">
{{ t("grid.totalRows", { count: result.rows.length }) }}
<span v-if="typeof totalRowCount === 'number' && totalRowCount > 0" class="text-muted-foreground/70">{{
t("grid.totalRowCount", { count: totalRowCount })
}}</span>
</span>
<span v-if="showTruncationWarning" class="text-amber-500 text-xs ml-1">(truncated)</span>
<span v-if="!hasData">{{ t("grid.rowsAffected", { count: result.affected_rows }) }}</span>
<span>{{ result.execution_time_ms }}ms</span>
@@ -424,6 +424,7 @@ defineExpose({ focusSearch, refreshData, handleModRTarget });
:page-offset="activeTab.resultPageOffset"
:page-limit="activeTab.resultPageLimit"
:count-sql="activeTab.resultCountSql"
:total-row-count="activeTab.resultTotalRowCount"
:on-execute-sql="async (sql: string) => emit('executeSql', sql)"
@reload="
(