From 92f5517e3ee985249a5796a07bb239d68a7b82f8 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Wed, 1 May 2024 12:55:39 +0100 Subject: [PATCH] Fix pagination for `Show Table Records` --- src/ls/queries.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ls/queries.ts b/src/ls/queries.ts index a8a0ea7..751c48b 100644 --- a/src/ls/queries.ts +++ b/src/ls/queries.ts @@ -92,8 +92,11 @@ const treeFunctionFilter = function(p: { [key: string]: any }): string { } const fetchRecords: IQueries['fetchRecords'] = queryFactory` -SELECT TOP ${p => p.limit || 50} * -FROM ${p => p.table.schema}.${p => (p.table.label || p.table)} +SELECT * FROM ( + SELECT TOP ALL * + FROM ${p => p.table.schema}.${p => (p.table.label || p.table)} +) +WHERE %vid BETWEEN ${p => (p.offset || 0) + 1} AND ${p => ((p.offset || 0) + (p.limit || 50))} `; const countRecords: IQueries['countRecords'] = queryFactory`