--- db/prgsrc/updatedb.pl 2002/11/11 09:06:23 1.26 +++ db/prgsrc/updatedb.pl 2002/11/11 09:57:49 1.28 @@ -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.28 2002/11/11 09:57:49 roma7 Exp $ =cut @@ -58,7 +58,7 @@ my ($sth); use DBI; use strict; - +my $isunsorted=0; sub UpdateParents { my ($dbh, $ParentId, $all_qnum) = @_; if ($ParentId) { @@ -144,7 +144,8 @@ sub SelectGroup { # Теперь, если файла нет в дереве турниров, никаких вопросов не # задаётся, а вместо этого он добавляется в группу 9999 $ParentId = 9999; - print UNSORTED $source; + print UNSORTED "$source\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; }