--- db/prgsrc/updatedb.pl 2002/11/09 01:47:23 1.25 +++ db/prgsrc/updatedb.pl 2003/01/08 21:54:49 1.29 @@ -28,7 +28,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.25 2002/11/09 01:47:23 roma7 Exp $ +=head1 $Id: updatedb.pl,v 1.29 2003/01/08 21:54:49 roma7 Exp $ =cut @@ -36,7 +36,7 @@ use vars qw($opt_i); use Getopt::Std; getopts('i'); - +#open STDERR, ">errors"; my $Interactive=$opt_i || 0; @@ -58,7 +58,7 @@ my ($sth); use DBI; use strict; - +my $isunsorted=0; sub UpdateParents { my ($dbh, $ParentId, $all_qnum) = @_; if ($ParentId) { @@ -144,10 +144,8 @@ sub SelectGroup { # Теперь, если файла нет в дереве турниров, никаких вопросов не # задаётся, а вместо этого он добавляется в группу 9999 $ParentId = 9999; -print STDERR "INSERT INTO Tournaments - (Title, Type, ParentId, FileName) - VALUES ($TourName, 'Ч', $ParentId, - $source)"; + print UNSORTED "$source\n"; + $isunsorted=1; $sth = $dbh->prepare("INSERT INTO Tournaments (Title, Type, ParentId, FileName) VALUES ($TourName, 'Ч', $ParentId, @@ -271,6 +269,7 @@ MAIN: my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") or die "Can't connect to DB chgk\n"; my @sources; + open UNSORTED, ">unsorted"; while ($source = shift) { push @sources,glob($source); } @@ -406,5 +405,7 @@ MAIN: &UpdateParents($dbh, $ParentId, $all_qnum); print STDERR "Всего вопросов: $all_qnum \n"; } + close UNSORTED; + unlink "unsorted" unless $isunsorted; $dbh->disconnect; }