Diff for /db/prgsrc/updatedb.pl between versions 1.16 and 1.45

version 1.16, 2000/10/22 23:47:06 version 1.45, 2009/05/21 11:33:26
Line 6  updatedb.pl - a script for creation of n Line 6  updatedb.pl - a script for creation of n
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
 updatedb.pl I<file1> I<file2>....  updatedb.pl B<[-i]> I<file1> I<file2>....
   
   
 =head1 DESCRIPTION  =head1 DESCRIPTION
   
 Updates information in the B<chgk> databse. Uses file  Updates information in the B<chgk> databse. Uses file
   
   =head1 OPTIONS
   
   =item B<-i> 
   
   Ask about ParentId. 
   
   
 =head1 BUGS  =head1 BUGS
   
Line 26  Dmitry Rubinstein Line 32  Dmitry Rubinstein
   
 =cut  =cut
   
   use vars qw($opt_i);
   
   use Getopt::Std;
   my $unsortedname="../dump/unsorted";
   getopts('i');
   #open STDERR, ">errors";
   my $Interactive=$opt_i || 0;
   my $DUMPDIR = $ENV{DUMPDIR} || "../dump";
   
 my (%RevMonths) =   my (%RevMonths) = 
     ('Jan', '1', 'Feb', '2', 'Mar', '3', 'Apr', '4', 'May', '5', 'Jun', '6',      ('Jan', '1', 'Feb', '2', 'Mar', '3', 'Apr', '4', 'May', '5', 'Jun', '6',
      'Jul', '7', 'Aug', '8', 'Sep', '9', 'Oct', '10', 'Nov', '11',       'Jul', '7', 'Aug', '8', 'Sep', '9', 'Oct', '10', 'Nov', '11',
Line 44  my ($sth); Line 59  my ($sth);
   
 use DBI;  use DBI;
 use strict;  use strict;
   my $isunsorted=0;
 sub UpdateParents {  sub UpdateParents {
     my ($dbh, $ParentId, $all_qnum) = @_;      my ($dbh, $ParentId, $all_qnum,$CreatedAt) = @_;
     if ($ParentId) {      if ($ParentId) {
         my ($sth1) = $dbh->prepare("SELECT QuestionsNum, ParentId     my ($sth1) = $dbh->prepare("SELECT QuestionsNum, ParentId, CreatedAt
 FROM Tournaments WHERE Id = $ParentId");  FROM Tournaments WHERE Id = $ParentId");
         $sth1->execute;    $sth1->execute;
         my ($q, $p) = ($sth1->fetchrow)[0, 1];    my ($q, $p,$c) = ($sth1->fetchrow)[0, 1, 2];
         $dbh->do("UPDATE Tournaments SET     $c=$CreatedAt if $CreatedAt && ($CreatedAt gt $c);
                   QuestionsNum=$q + $all_qnum     my $qc=$dbh->quote($c);
     $dbh->do("UPDATE Tournaments SET 
                     QuestionsNum=$q + $all_qnum, CreatedAt=$qc
                   WHERE Id = $ParentId");                    WHERE Id = $ParentId");
         &UpdateParents($dbh, $p, $all_qnum);    &UpdateParents($dbh, $p, $all_qnum,$c);
     }      }
 }  }
   
   
 sub getField {  sub getField {
     my($desc, $dbh) = @_;      my($desc, $dbh) = @_;
     my($key);      my($key);
     my($value) = ('');      my($value) = ('');
     while (<$desc>) {      while (<$desc>) {
         s/[ ]//g;    s/[ ]//g;
         if ($key && /^\s*$/) {    if ($key && /^\s*$/) {
             chomp $value;        chomp $value;
             chomp $key;              $value =~ s/\s+$//;
             if ($key eq 'Дата') {        chomp $key;
                 $value =~ s/^(.*)-(.*)-(.*)$/$3-$2-$1/;        if ($key eq 'Дата') {
                 my($month) = $RevMonths{$2} || '000';      $value =~ s/^(.*)-(.*)-(.*)$/$3-$2-$1/;
                 $value =~ s/$2/$month/;      my($month) = $RevMonths{$2} || '01';
             }      $value =~ s/-(.*)-/-$month-/;
             $value = $dbh->quote($value);      $value =~ s/-00*$/-01/;
             return ($key, $value);        }
         }        if ($key eq 'Автор') {$value=~s/\.$//;}
         next if (/^\s*$/);        $value = $dbh->quote($value);
                 return ($key, $value);
         if (!$key && /^(.*?)[:\.]\s*(.*)$/s) {    }
             $key = $1;    next if (/^\s*$/);
             $value=$2;    
             next;    if (!$key && /^(.*?)[:\.]\s*(.*)$/s) {
         }        $key = $1;
         if ($key) {        $value=$2;
             $value .= $_;        next;
             next;    }
         }    if ($key) {
         $value .= $_;
         next;
     }
     }      }
     if ($key && $value) {      if ($key && $value) {
         $value = $dbh->quote($value);          $value=~s/\s+$//;
         return ($key, $value);    $value = $dbh->quote($value);
     return ($key, $value);
     }      }
     return (0, 0);      return (0, 0);
 }  }
Line 98  sub getField { Line 120  sub getField {
 sub SelectGroup {  sub SelectGroup {
     my ($dbh, $source, $TourName) = @_;      my ($dbh, $source, $TourName) = @_;
     my ($sth, $ParentId, $i, @arr);      my ($sth, $ParentId, $i, @arr);
       
     $sth = $dbh->prepare("SELECT Id, Title FROM      if ($Interactive) {    
                 Tournaments WHERE Type = 'Г'");        $sth = $dbh->prepare("SELECT Id, Title FROM
       Tournaments WHERE Type = 'Г'");
         $sth->execute;
         print "Выберите группу для турнира:\n$TourName, файл $source\n\n";
         while (@arr=$sth->fetchrow) {
       print "[$arr[0]] $arr[1]\n";
         }
         $ParentId = <STDIN>;
         chomp $ParentId;
         if (!$ParentId) {
       print "Пропускаем файл $source\n";
       print STDERR "Файл $source отвергнут оператором\n";
       return (0,0);
         } else {
       print "Вы выбрали турнир: $ParentId\n";
       $sth = $dbh->prepare("INSERT INTO Tournaments
               (Title, Type, ParentId, FileName) 
                VALUES ($TourName, 'Ч', $ParentId, 
                                          $source)");
     $sth->execute;      $sth->execute;
     print "Выберите группу для турнира:\n$TourName, файл $source\n\n";      my $TournamentId = $sth->{mysql_insertid};
     while (@arr=$sth->fetchrow) {      return ($TournamentId,$ParentId);
         print "[$arr[0]] $arr[1]\n";    }
     }  
     $ParentId = <STDIN>;  
     chomp $ParentId;  
     if (!$ParentId) {  
         print "Пропускаем файл $source\n";  
         print STDERR "Файл $source отвергнут оператором\n";  
         return (0,0);  
     } else {      } else {
         print "Вы выбрали турнир: $ParentId\n";  # Теперь, если файла нет в дереве турниров, никаких вопросов не 
         $sth = $dbh->prepare("INSERT INTO Tournaments  # задаётся, а вместо этого он добавляется в группу 9999
                               (Title, Type, ParentId, FileName)       $ParentId = 9999;
                                VALUES ($TourName, 'Ч', $ParentId,       my $tempsource=$source;
                                        $source)");      my $temptname=$TourName;
         $sth->execute;                  $tempsource=~s/^\'(.*)\'$/$1/;
         my $TournamentId = $sth->{mysql_insertid};                  $temptname=~s/^\'(.*)\'$/$1/;
         return ($TournamentId,$ParentId);        print UNSORTED "$tempsource".((12 -length($source))x' ')."\t$temptname\n";
     }      $isunsorted=1;
                       $sth = $dbh->prepare("INSERT INTO Tournaments
               (Title, Type, ParentId, FileName,CreatedAt) 
                VALUES ($TourName, 'Ч', $ParentId, 
                                          $source,NOW())");
                   $sth->execute;
       my $TournamentId = $sth->{mysql_insertid};
       return ($TournamentId,$ParentId);
     }
       
           
 }  }
   
 sub UpdateTournament {  sub UpdateTournament {
     my ($dbh, $TournamentId, $field, $value) = @_;      my ($dbh, $TournamentId, $field, $value) = @_;
     $dbh->do("UPDATE Tournaments SET $field=$value WHERE Id=$TournamentId")      $dbh->do("UPDATE Tournaments SET $field=$value WHERE Id=$TournamentId")
         or die $dbh->errstr;    or die $dbh->errstr;
 }  }
   
 sub UpdateQuestion {  sub UpdateQuestion {
     my ($dbh, $QuestionId, $field, $value) = @_;      my ($dbh, $QuestionId, $field, $value) = @_;
       
       if (($field eq 'Type') && ($value eq "'Д'")) {
            $value = "'ЧД'";
       }
     $dbh->do("UPDATE Questions SET $field=$value       $dbh->do("UPDATE Questions SET $field=$value 
                 WHERE QuestionId=$QuestionId")      WHERE QuestionId=$QuestionId")
         or die $dbh->errstr;    or die $dbh->errstr;
 }  }
   
 sub CheckFile {  sub CheckFile {
Line 146  sub CheckFile { Line 191  sub CheckFile {
     $sth->execute or die $dbh->errstr;      $sth->execute or die $dbh->errstr;
     my @arr = $sth->fetchrow;      my @arr = $sth->fetchrow;
     if (! scalar @arr) {      if (! scalar @arr) {
         return SelectGroup($dbh,$source,$title);    return SelectGroup($dbh,$source,$title);
     }      }
     my($Id,$ParentId,$QuestionsNum)=@arr;      my($Id,$ParentId,$QuestionsNum)=@arr;
     if($QuestionsNum) {       if($QuestionsNum) { 
         print "Файл $source с данными $title уже существует. ",    print "Файл $source с данными $title уже существует. ",
         "Заменить?[y/N]\n";    "Заменить?[y/N]\n";
         my $answer = <STDIN>;    my $answer = <STDIN>;
         if ($answer !~ /^[yY]/) {    if ($answer !~ /^[yY]/) {
             return (0,0);        return (0,0);
         } else {    } else {
             DeleteTournament($dbh,$Id,$ParentId,$QuestionsNum,0);        DeleteTournament($dbh,$Id,$ParentId,$QuestionsNum,0);
         }    }
     }       } 
     return($Id,$ParentId);            return($Id,$ParentId);  
 }  }
   
   
 sub DeleteTournament {  sub DeleteTournament {
     my ($dbh,$Id,$ParentId,$QuestionsNum,$DeleteMyself) = @_;      my ($dbh,$Id,$ParentId,$QuestionsNum,$DeleteMyself) = @_;
     if ($QuestionsNum) {      if ($QuestionsNum) {
         UpdateParents($dbh,$ParentId,-$QuestionsNum);    UpdateParents($dbh,$ParentId,-$QuestionsNum);
     }      }
     my (@Tours) = &GetTours($dbh, $Id);      my (@Tours) = &GetTours($dbh, $Id);
     foreach my $Tour (@Tours) {      foreach my $Tour (@Tours) {
         DeleteTournament($dbh,$Tour,$Id,0,1);    DeleteTournament($dbh,$Tour,$Id,0,1);
     }      }
     my $sth = $dbh->prepare("DELETE FROM Questions      my $sth = $dbh->prepare("DELETE FROM Questions
                              WHERE ParentId=$Id");                               WHERE ParentId=$Id");
     $sth->execute or die $dbh->errstr;      $sth->execute or die $dbh->errstr;
     if($DeleteMyself) {      if($DeleteMyself) {
         $sth = $dbh->prepare("DELETE FROM Tournaments    $sth = $dbh->prepare("DELETE FROM Tournaments
                              WHERE Id=$Id");                               WHERE Id=$Id");
         $sth->execute or die $dbh->errstr;    $sth->execute or die $dbh->errstr;
     }      }
 }  }
   
 sub GetTours {  sub GetTours {
         my ($dbh, $ParentId) = @_;    my ($dbh, $ParentId) = @_;
         my (@arr, @Tours);    my (@arr, @Tours);
   
         my ($sth) = $dbh->prepare("SELECT Id FROM Tournaments    my ($sth) = $dbh->prepare("SELECT Id FROM Tournaments
                 WHERE ParentId=$ParentId ORDER BY Id");      WHERE ParentId=$ParentId ORDER BY Id");
   
         $sth->execute;    $sth->execute;
   
         while (@arr = $sth->fetchrow) {    while (@arr = $sth->fetchrow) {
                 push @Tours, $arr[0];      push @Tours, $arr[0];
         }    }
   
         return @Tours;    return @Tours;
 }  }
   
 sub CreateTour {  sub CreateTour {
     my ($dbh,$title,$ParentId,$rh_defaults)=@_;      my ($dbh,$title,$ParentId,$TourNum,$rh_defaults)=@_;
     my $sth = $dbh->prepare("INSERT INTO Tournaments      my $sth = $dbh->prepare("INSERT INTO Tournaments
                              (Title, Type, ParentId)              (Title, Type, ParentId, Number,CreatedAt) 
                              VALUES ($title, 'Т', $ParentId)");             VALUES ($title, 'Т', $ParentId, $TourNum,NOW())");
     $sth->execute;      $sth->execute;
     my $TourId = $sth->{mysql_insertid};      my $TourId = $sth->{mysql_insertid};
     while (my ($key,$value)=each %$rh_defaults) {      while (my ($key,$value)=each %$rh_defaults) {
         &UpdateTournament($dbh, $TourId, $key, $value);    &UpdateTournament($dbh, $TourId, $key, $value);
     }      }
     return $TourId;      return $TourId;
 }  }
                       
   
 MAIN:   MAIN: 
 {  {
Line 219  MAIN: Line 264  MAIN:
     # Inherited fields for a Tour or Tournament      # Inherited fields for a Tour or Tournament
     #      #
     my %TourFields = ('Копирайт' => 'Copyright',      my %TourFields = ('Копирайт' => 'Copyright',
                       'Инфо' => 'Info', 'URL' => 'URL',            'Инфо' => 'Info', 'URL' => 'URL',
                       'Ссылка' => 'URL', 'Редактор' => 'Editors',            'Ссылка' => 'URL', 'Редактор' => 'Editors',
                       'Обработан'=> 'EnteredBy',            'Обработан'=> 'EnteredBy',
                       'Дата'=>'PlayedAt');            'Дата'=>'PlayedAt');
     #      #
     # Inherited fields for a Question      # Inherited fields for a Question
     #      #
     my %QuestionFields = ('Тип'=> 'Type', 'Вид'=> 'Type',       my %QuestionFields = ('Тип'=> 'Type', 'Вид'=> 'Type', 
                           'Автор' => 'Authors', 'Рейтинг'=>'Rating',           'Автор' => 'Authors', 'Рейтинг'=>'Rating', 
                           'Источник' => 'Sources');          'Источник' => 'Sources',
                                     'Тема' => 'Topic');
                                 
             
     my($source);      my($source);
           
     my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "")      my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "")
         or die "Can't connect to DB chgk\n";    or die "Can't connect to DB chgk\n";
       if ($dbh->get_info( 18 )=~/^(5|(4.1))/)  {$dbh->do("SET NAMES 'koi8r'");}
       my @sources;  
       open UNSORTED, ">$unsortedname";
     while ($source = shift) {      while ($source = shift) {
         my($PlayedAt) = '';         push @sources,glob($source);
         my($QuestionId, $TourId, $TournamentId, $ParentId) = (0, 0, 0, 0);      }
         my($tournum, $qnum, $all_qnum) = (0, 0, 0);      foreach $source(@sources) {
         my (@d) = (localtime((stat($source))[9]))[5,4,3];    my $TourNum=0;
         $d[1]++;    my($PlayedAt) = '';
         $d[0]+=1900;    my($QuestionId, $TourId, $TournamentId, $ParentId) = (0, 0, 0, 0);
         my ($CreatedAt) = $dbh->quote( join('-', @d));    my($tournum, $qnum, $all_qnum) = (0, 0, 0);
     my (@d) = (localtime((stat($source))[9]))[5,4,3];
         open INFD, $source     $d[1]++;
             or die "Can't open input file: $!\n";    $d[1]=sprintf("%02d",$d[1]);
             $d[2]=sprintf("%02d",$d[2]);
         $source =~ s/^.*\/([^\/]*)$/$1/;    $d[0]+=1900;
         $source = $dbh->quote($source);    my $UnquotedCreated=join('-', @d);
         print STDERR "Файл: $source, дата: $CreatedAt ";    my ($CreatedAt) = $dbh->quote($UnquotedCreated);
         my %TourDefaults=('CreatedAt'=>$CreatedAt);  
         my %QuestionDefaults=();    open INFD, $source 
         my %QuestionGlobalDefaults=('Type'=>$dbh->quote('Ч'));        or die "Can't open input file: $!\n";
         while (($key, $value) = getField(\*INFD, $dbh)) {    
             last if (!$key);    $source =~ s/^.*\/([^\/]*)$/$1/;
                 my $unquotedsource=$source;
             if ($key =~ /Мета/) {    $unquotedsource=~s/\.txt\s*$//;
                 next;   # This is obsolete    $source = $dbh->quote($source);
             }    print STDERR "Файл: $source, дата: $CreatedAt ";
             if ($key =~ /Чемпионат/ || $key =~ /Пакет/) {                   my %TourDefaults=('CreatedAt'=>$CreatedAt);
                 ($TournamentId, $ParentId) = CheckFile($dbh,$source,$value);    my %QuestionDefaults=();
                 if (!$TournamentId)  {    my %QuestionGlobalDefaults=('Type'=>$dbh->quote('Ч'));
                     last;    while (($key, $value) = getField(\*INFD, $dbh)) {
                 }               last if (!$key);
                 $sth = $dbh->prepare("UPDATE Tournaments SET        
                                      Title=$value, Type='Ч',         if ($key =~ /Мета/) {
       next;   # This is obsolete
         }
         if ($key =~ /Чемпионат/ || $key =~ /Пакет/) {   
       ($TournamentId, $ParentId) = CheckFile($dbh,$source,$value);
       if (!$TournamentId)  {
           last;
       } 
       $sth = $dbh->prepare("UPDATE Tournaments SET
                      Title=$value, Type='Ч', 
                                      ParentId=$ParentId,                                        ParentId=$ParentId, 
                                      FileName=$source,                                        FileName=$source, 
                                      CreatedAt=$CreatedAt                                       CreatedAt=$CreatedAt
                                      WHERE                                       WHERE
                                      Id=$TournamentId");                                       Id=$TournamentId");
                 $sth->execute;      $sth->execute;
                 next;      next;
             }        }
             if ($key =~ /Тур/) {        if ($key =~ /Тур/) {
                 if ($TourId) {      if ($TourId) {
                     $dbh->do("UPDATE Tournaments SET QuestionsNum=$qnum  
                               WHERE Id=$TourId");            $dbh->do("UPDATE Tournaments SET QuestionsNum=$qnum
                 }              WHERE Id=$TourId");
                 $qnum = 0;      }
                 $TourId=CreateTour($dbh,$value,$TournamentId,\%TourDefaults);      $qnum = 0;
                 %QuestionDefaults=%QuestionGlobalDefaults;      $TourNum++;
                 $QuestionId=0;      $TourDefaults{'FileName'}=$dbh->quote(
                 next;                                   "$unquotedsource.$TourNum"
             }              );
             if ($key =~ /Вопрос/) {      $TourId=CreateTour($dbh,$value,$TournamentId,$TourNum,
                 if (!$TourId) {             \%TourDefaults);
                     $qnum = 0;      %QuestionDefaults=%QuestionGlobalDefaults;
                     $TourId=CreateTour($dbh,'1',$TournamentId,      $QuestionId=0;
                                        \%TourDefaults);      next; 
                     %QuestionDefaults=%QuestionGlobalDefaults;        }
                 }        if ($key =~ /Вопрос/) {
                 my $query = "INSERT INTO Questions       if (!$TourId) {
                              (ParentId, Number)           $qnum = 0;
                              VALUES ($TourId, $qnum+1)";          $TourNum++;
                 $sth = $dbh->prepare($query);          $TourId=CreateTour($dbh,'1',$TournamentId,$TourNum,
                 $sth->execute or print $query;;                 \%TourDefaults);
                 $QuestionId = $sth->{mysql_insertid};          %QuestionDefaults=%QuestionGlobalDefaults;
                 &UpdateQuestion($dbh, $QuestionId, "Question", $value);      }
                 while (my ($key,$value)=each %QuestionDefaults) {      my $query = "INSERT INTO Questions 
                     &UpdateQuestion($dbh, $QuestionId, $key, $value);             (ParentId, Number) 
                 }                            VALUES ($TourId, $qnum+1)";
                 $qnum++;      $sth = $dbh->prepare($query);
                 $all_qnum++;      $sth->execute or print $query;;
                 next;      $QuestionId = $sth->{mysql_insertid};
             }      &UpdateQuestion($dbh, $QuestionId, "Question", $value);
       while (my ($key,$value)=each %QuestionDefaults) {
             if ($key =~ /Ответ/) {          &UpdateQuestion($dbh, $QuestionId, $key, $value);
                 &UpdateQuestion($dbh, $QuestionId, "Answer", $value);      }   
                 next;      $qnum++;
             }      $all_qnum++;
       next;
             if ($key =~ /Комментари/) {        }
                 &UpdateQuestion($dbh, $QuestionId, "Comments", $value);  
                 next;        if ($key =~ /Ответ/) {
             }      &UpdateQuestion($dbh, $QuestionId, "Answer", $value);
                   next;
             my @Fields = grep { $key =~ /$_/ } keys %QuestionFields;        }
   
             if (scalar @Fields) {  
                 my $word = shift @Fields;        if ($key =~ /Зач[её]т/) {
                 my $field = $QuestionFields{$word};      &UpdateQuestion($dbh, $QuestionId, "PassCriteria", $value);
                 if ($QuestionId) {      next;
                     &UpdateQuestion($dbh, $QuestionId, $field, $value);        }
                 } elsif ($TourId) {  
                     $QuestionDefaults{$field}=$value;  
                 } else {  
                     $QuestionGlobalDefaults{$field}=$value;        if ($key =~ /Комментари/) {
                 }      &UpdateQuestion($dbh, $QuestionId, "Comments", $value);
                 next;      next;
             }        }
   
             @Fields = grep { $key =~ /$_/ } keys %TourFields;  
         
             if (scalar @Fields) {        my @Fields = grep { $key =~ /$_/ } keys %QuestionFields;
                 my $word = shift @Fields;  
                 my $field = $TourFields{$word};        if (scalar @Fields) {
                 if ($QuestionId) {      my $word = shift @Fields;
                     print STDERR "ОШИБКА: $key $value недопустимы после",      my $field = $QuestionFields{$word};
                     " начала вопросов\n";      if ($QuestionId) {
                 } elsif ($TourId) {          &UpdateQuestion($dbh, $QuestionId, $field, $value);
                     &UpdateTournament($dbh, $TourId, $field, $value);      } elsif ($TourId) {
                 } else {          $QuestionDefaults{$field}=$value;
                     &UpdateTournament($dbh, $TournamentId, $field, $value);      } else {
                     $TourDefaults{$field}=$value;          $QuestionGlobalDefaults{$field}=$value;
                 }      }
                 next;      next;
             }        }
   
                     @Fields = grep { $key =~ /$_/ } keys %TourFields;
             #  
             # If we are here, something got wrong!        if (scalar @Fields) {
             #      my $word = shift @Fields;
             print STDERR "\nЯ НЕ ПОНИМАЮ: $key, $value!\n";      my $field = $TourFields{$word};
                   if ($QuestionId) {
         }          print STDERR "ОШИБКА: $key $value недопустимы после",
         $dbh->do("UPDATE Tournaments SET QuestionsNum=$qnum          " начала вопросов\n";
                         WHERE Id=$TourId");      } elsif ($TourId) {
         $dbh->do("UPDATE Tournaments SET QuestionsNum=$all_qnum          &UpdateTournament($dbh, $TourId, $field, $value);
                         WHERE Id=$TournamentId");      } else {
         &UpdateParents($dbh, $ParentId, $all_qnum);                       &UpdateTournament($dbh, $TournamentId, $field, $value);
         print STDERR "Всего вопросов: $all_qnum \n";          $TourDefaults{$field}=$value;
       }
       next;
         }
   
         
         #
         # If we are here, something got wrong!
         #
         print STDERR "\nЯ НЕ ПОНИМАЮ: $key, $value!\n";
         
     }
     $dbh->do("UPDATE Tournaments SET QuestionsNum=$qnum
         WHERE Id=$TourId");
     $dbh->do("UPDATE Tournaments SET QuestionsNum=$all_qnum
         WHERE Id=$TournamentId");
     &UpdateParents($dbh, $ParentId, $all_qnum,$UnquotedCreated);    
     print STDERR "Всего вопросов: $all_qnum \n";
     }      }
       close UNSORTED;
       unlink $unsortedname unless $isunsorted;
     $dbh->disconnect;      $dbh->disconnect;
 }  }

Removed from v.1.16  
changed lines
  Added in v.1.45


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>