]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Msgmap.pm
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / lib / PublicInbox / Msgmap.pm
index 5a89b85a51e297660291f0c4e5477bd2865608da..9523752e9af07f8b973ac45d5a5aeda408801513 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # bidirectional Message-ID <-> Article Number mapping for the NNTP
@@ -211,11 +211,12 @@ ORDER BY num ASC LIMIT 1000
 }
 
 sub msg_range {
-       my ($self, $beg, $end) = @_;
+       my ($self, $beg, $end, $cols) = @_;
+       $cols //= 'num,mid';
        my $dbh = $self->{dbh};
        my $attr = { Columns => [] };
-       my $mids = $dbh->selectall_arrayref(<<'', $attr, $$beg, $end);
-SELECT num,mid FROM msgmap WHERE num >= ? AND num <= ?
+       my $mids = $dbh->selectall_arrayref(<<"", $attr, $$beg, $end);
+SELECT $cols FROM msgmap WHERE num >= ? AND num <= ?
 ORDER BY num ASC LIMIT 1000
 
        $$beg = $mids->[-1]->[0] + 1 if @$mids;