]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Over.pm
www: rework query responses to avoid COUNT in SQLite
[public-inbox.git] / lib / PublicInbox / Over.pm
index cf7a884997d23a5b4fe94bab61f7e8a8719ca9a5..c74072a26c063ea3c8acaebf1b06f9da34ba03a8 100644 (file)
@@ -88,10 +88,12 @@ LIMIT 1
 SELECT * $cond
 ORDER BY ts ASC
 
+       return $msgs unless wantarray;
+
        my $nr = $dbh->selectrow_array(<<"", undef, $tid, $sid);
 SELECT COUNT(num) $cond
 
-       { total => $nr, msgs => $msgs };
+       ($nr, $msgs);
 }
 
 sub recent {
@@ -100,10 +102,12 @@ sub recent {
 SELECT * FROM over WHERE num > 0
 ORDER BY ts DESC
 
+       return $msgs unless wantarray;
+
        my $nr = $self->{dbh}->selectrow_array(<<'');
 SELECT COUNT(num) FROM over WHERE num > 0
 
-       { total => $nr, msgs => $msgs };
+       ($nr, $msgs);
 }
 
 sub get_art {