From 678910fb132ce469ddad7d45c94bb00a3fe220d5 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 17 Jul 2009 00:28:07 +0100 Subject: [PATCH] sqlite fails at count distinct --- ext/comment/main.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 176bcc05..b643f039 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -222,7 +222,7 @@ class CommentList implements Extension { "; $result = $database->Execute($get_threads, array($threads_per_page, $start)); - $total_pages = (int)($database->db->GetOne("SELECT COUNT(distinct image_id) AS count FROM comments") / 10); + $total_pages = (int)($database->db->GetOne("SELECT COUNT(image_id) AS count FROM comments GROUP BY image_id") / 10); $this->theme->display_page_start($page, $current_page, $total_pages); @@ -287,6 +287,9 @@ class CommentList implements Extension { global $config; global $database; + // sqlite fails at intervals + if($database->engine->name == "sqlite") return false; + $window = int_escape($config->get_int('comment_window')); $max = int_escape($config->get_int('comment_limit'));