--- db/prgsrc/updateindex.pl 2000/10/22 01:25:25 1.6 +++ db/prgsrc/updateindex.pl 2000/11/11 00:35:39 1.7 @@ -6,7 +6,7 @@ updateindex.pl - a script for creation o =head1 SYNOPSIS -updateind.pl [B<-i> I] [B<-y>|B<-n>] +updateind.pl [B<-i> I] [B<-y>|B<-n>] [B<-r>] =head1 DESCRIPTION @@ -42,6 +42,10 @@ Answer 'yes' to all questions Answer 'no' to all questions +=item B<-r> + +Remove all entries with zero QuestionNum + =head1 BUGS The database, user and password are hardcoded. @@ -54,20 +58,21 @@ createindex.pl(1) Boris Veytsman -=head1 $Id: updateindex.pl,v 1.6 2000/10/22 01:25:25 boris Exp $ +=head1 $Id: updateindex.pl,v 1.7 2000/11/11 00:35:39 boris Exp $ =cut use strict; -use vars qw($opt_i $opt_h $opt_y $opt_n); +use vars qw($opt_i $opt_h $opt_y $opt_n $opt_r); use Getopt::Std; use DBI; MAIN: { - my $USAGE="Usage: updateindex.pl [-i indexfile] [-y|-n]\n"; - getopts('hi:yn') or die $USAGE; + my $USAGE="Usage: updateindex.pl [-i indexfile] [-y|-n][-r]\n"; + my $REMOVE=0; + getopts('hi:ynr') or die $USAGE; if ($opt_h) { print $USAGE; exit 0; @@ -79,6 +84,9 @@ MAIN: if ($opt_n ) { $decision = 'no'; } + if ($opt_r) { + $REMOVE=1; + } my($source) = $opt_i; my($depth, @depthId); my $filename; @@ -119,6 +127,10 @@ MAIN: } print STDERR "Всего вопросов: ", UpdateGroup($dbh,0),"\n"; + if ($REMOVE) { + print STDERR "Removing empty tours."; + $dbh->do("DELETE FROM Tournaments WHERE QuestionsNum=0"); + } $dbh->disconnect; }