]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
isearch: support 64-bit article numbers for SQLite query
authorEric Wong <e@80x24.org>
Sat, 6 May 2023 22:40:03 +0000 (22:40 +0000)
committerEric Wong <e@80x24.org>
Sun, 7 May 2023 21:45:14 +0000 (21:45 +0000)
While IMAP UIDs are specified as 32-bit in RFC 3501, there's no
reason we can't support 64-bit article numbers on our end when
the time comes.  Neither NNTP nor POP3 have the 32-bit
limitation, even, so it's not inconceivable that IMAP will drop
that limitation at some point, too.

lib/PublicInbox/Isearch.pm

index 2b45e08e8447b67d8234852f0f7290f84c907b26..5cbc36fde8b326913955ed188f504203dbb3aedb 100644 (file)
@@ -1,12 +1,11 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Provides everything the PublicInbox::Search object does;
 # but uses global ExtSearch (->ALL) with an eidx_key query to
 # emulate per-Inbox search using ->ALL.
 package PublicInbox::Isearch;
-use strict;
-use v5.10.1;
+use v5.12;
 use PublicInbox::ExtSearch;
 use PublicInbox::Search;
 
@@ -48,8 +47,8 @@ SELECT MAX(docid) FROM xref3 WHERE ibx_id = ? AND xnum >= ? AND xnum <= ?
                $r[1] = $sth->fetchrow_array;
                if (defined($r[1]) && defined($r[0])) {
                        $opt{limit} = $r[1] - $r[0] + 1;
-               } else {
-                       $r[1] //= 0xffffffff;
+               } else { # these are fed to SQLite
+                       $r[1] //= '0x7'.('f'x15); # string for some 32-bit Perl
                        $r[0] //= 0;
                }
                $opt{uid_range} = \@r;