lib/PublicInbox/OverIdx.pm | 10 +++++++--- diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 635aa314373ac6ca3c3da231a7237efbc909ec66..38552247c397ca84c8bb2acaa7964fb3a5568cbf 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -79,6 +79,11 @@ $dbh->last_insert_id(undef, undef, $tbl, $id_col); } } +sub ibx_id { + my ($self, $eidx_key) = @_; + id_for($self, 'inboxes', 'ibx_id', eidx_key => $eidx_key); +} + sub sid { my ($self, $path) = @_; return unless defined $path && $path ne ''; @@ -588,7 +593,7 @@ sub add_xref3 { my ($self, $docid, $xnum, $oidhex, $eidx_key) = @_; begin_lazy($self); - my $ibx_id = id_for($self, 'inboxes', 'ibx_id', eidx_key => $eidx_key); + my $ibx_id = ibx_id($self, $eidx_key); my $oidbin = pack('H*', $oidhex); my $sth = $self->{dbh}->prepare_cached(<<''); INSERT OR IGNORE INTO xref3 (docid, ibx_id, xnum, oidbin) VALUES (?, ?, ?, ?) @@ -607,8 +612,7 @@ begin_lazy($self); my $oidbin = pack('H*', $oidhex); my ($sth, $ibx_id); if (defined $eidx_key) { - $ibx_id = id_for($self, 'inboxes', 'ibx_id', - eidx_key => $eidx_key); + $ibx_id = ibx_id($self, $eidx_key); $sth = $self->{dbh}->prepare_cached(<<''); DELETE FROM xref3 WHERE docid = ? AND ibx_id = ? AND oidbin = ?