--- db/prgsrc/updatedb.pl 2002/11/11 09:06:23 1.26 +++ db/prgsrc/updatedb.pl 2003/01/08 23:36:38 1.30 @@ -28,7 +28,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.26 2002/11/11 09:06:23 roma7 Exp $ +=head1 $Id: updatedb.pl,v 1.30 2003/01/08 23:36:38 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) { @@ -143,8 +143,9 @@ sub SelectGroup { } else { # Теперь, если файла нет в дереве турниров, никаких вопросов не # задаётся, а вместо этого он добавляется в группу 9999 - $ParentId = 9999; - print UNSORTED $source; + $ParentId = 9999; + print UNSORTED "$source".((12 -length($source))x' ')."\t$TourName\n"; + $isunsorted=1; $sth = $dbh->prepare("INSERT INTO Tournaments (Title, Type, ParentId, FileName) VALUES ($TourName, 'Ч', $ParentId, @@ -404,5 +405,7 @@ MAIN: &UpdateParents($dbh, $ParentId, $all_qnum); print STDERR "Всего вопросов: $all_qnum \n"; } + close UNSORTED; + unlink "unsorted" unless $isunsorted; $dbh->disconnect; }