From fb671e61666a7a8c9bfb3ad55fa65daa2e1181bb Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Tue, 17 Sep 2019 20:46:32 +0100 Subject: [PATCH] fix page browser test for sqlite; see #87 and #161 (not tests/CreatePageBrowserTest.php) --- functions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions.inc.php b/functions.inc.php index f8805fa9..779c6e60 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -550,9 +550,11 @@ function create_page_browser($idxfield, $querypart) { } if (db_sqlite()) { + $bits = explode('.', $idxfield); + $end = $bits[1]; $query = " WITH idx AS (SELECT * $querypart) - SELECT $idxfield AS label, (SELECT (COUNT(*) - 1) FROM idx t1 WHERE t1.$idxfield <= t2.$idxfield) AS row + SELECT $end AS label, (SELECT (COUNT(*) - 1) FROM idx t1 WHERE t1.$end <= t2.$end ) AS row FROM idx t2 WHERE (row % $page_size) IN (0,$page_size_zerobase) OR row = $count_results"; }