diff options
Diffstat (limited to 'lib/PublicInbox/IMAPTracker.pm')
-rw-r--r-- | lib/PublicInbox/IMAPTracker.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/PublicInbox/IMAPTracker.pm b/lib/PublicInbox/IMAPTracker.pm index bcf7af2e..fe813582 100644 --- a/lib/PublicInbox/IMAPTracker.pm +++ b/lib/PublicInbox/IMAPTracker.pm @@ -39,12 +39,20 @@ sub dbh_new ($) { $dbh; } -sub get_last ($) { - my ($self) = @_; - my $sth = $self->{dbh}->prepare_cached(<<'', undef, 1); +sub get_last ($;$) { + my ($self, $validity) = @_; + my $sth; + if (defined $validity) { + $sth = $self->{dbh}->prepare_cached(<<'', undef, 1); +SELECT uid_validity, uid FROM imap_last WHERE url = ? AND uid_validity = ? + + $sth->execute($self->{url}, $validity); + } else { + $sth = $self->{dbh}->prepare_cached(<<'', undef, 1); SELECT uid_validity, uid FROM imap_last WHERE url = ? - $sth->execute($self->{url}); + $sth->execute($self->{url}); + } $sth->fetchrow_array; } |