X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bibtex_to_paper;h=5ac334ea9c086167fd5d260c9b9ece64cc6fa3f7;hb=0f7a3c326c73863ad3be12e916d7c345aa71a8e1;hp=66fdf09324fe6f2b868b13fb9e43025ddbabc13c;hpb=adfa486597b26723447c7d95cd18dfcb4cc1c972;p=bin.git diff --git a/bibtex_to_paper b/bibtex_to_paper index 66fdf09..5ac334e 100755 --- a/bibtex_to_paper +++ b/bibtex_to_paper @@ -90,6 +90,7 @@ GetOptions(\%options, 'bibtex|b=s@', 'bibtex_cache|bibtex-cache|c=s', 'pdfviewer|p=s', + 'clear_cache|clear-cache!', 'papers_directory|papers-directory=s@', 'debug|d+','help|h|?','man|m'); @@ -123,6 +124,9 @@ sub main{ } } + if (exists $options{clear_cache}) { + clear_cache($dbh,$sth); + } my %entries; if (exists $options{build_cache}) { $options{bibtex} //= []; @@ -157,6 +161,12 @@ sub main{ } +sub clear_cache { + my ($dbh,$sth) = @_; + $sth->{clear_papers_cache}->execute(); + $sth->{clear_bibtex_cache}->execute(); +} + sub load_papers_into_database { my ($dbh,$sth,$dir) = @_; @@ -393,6 +403,12 @@ SELECT * FROM bibtex WHERE bibtex_key LIKE ?; EOF select_bibtex_by_file_name => <<'EOF', SELECT * FROM bibtex WHERE file_name = ?; +EOF + clear_papers_cache => <<'EOF', +DELETE FROM papers; +EOF + clear_bibtex_cache => <<'EOF', +DELETE FROM bibtex; EOF ); my $st;