From b6829bbfd86f5d22a8ffb80fd7bfe59299fe6b55 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 20 Mar 2021 19:04:04 +0900 Subject: lei q: support vmd for external-only messages "lei q" now preserves changes per-message keywords across invocations when it's --output (Maildir or mbox) is reused (with or without --augment). In the future, these changes will be monitored via inotify, EVFILT_VNODE or IMAP IDLE, too. Unfortunately, this currently prevents "lei import" from ever importing a message that's in an external. That will be fixed in a future change. --- lib/PublicInbox/Over.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Over.pm') diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 06ea439d..587e0516 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -7,7 +7,7 @@ package PublicInbox::Over; use strict; use v5.10.1; -use DBI; +use DBI qw(:sql_types); # SQL_BLOB use DBD::SQLite; use PublicInbox::Smsg; use Compress::Zlib qw(uncompress); @@ -349,4 +349,24 @@ sub check_inodes { } } +sub blob_exists { + my ($self, $oidhex) = @_; + if (wantarray) { + my $sth = $self->dbh->prepare_cached(<<'', undef, 1); +SELECT docid FROM xref3 WHERE oidbin = ? + + $sth->bind_param(1, pack('H*', $oidhex), SQL_BLOB); + $sth->execute; + my $tmp = $sth->fetchall_arrayref; + map { $_->[0] } @$tmp; + } else { + my $sth = $self->dbh->prepare_cached(<<'', undef, 1); +SELECT COUNT(*) FROM xref3 WHERE oidbin = ? + + $sth->bind_param(1, pack('H*', $oidhex), SQL_BLOB); + $sth->execute; + $sth->fetchrow_array; + } +} + 1; -- cgit v1.2.3-24-ge0c7