Diff for /db/prgsrc/updatedb.pl between versions 1.14 and 1.18

version 1.14, 2000/10/22 05:10:12 version 1.18, 2000/11/11 03:58:59
Line 78  sub getField { Line 78  sub getField {
         }          }
         next if (/^\s*$/);          next if (/^\s*$/);
                   
         if (s/^(.*?)[:\.]\s*// && !$key) {          if (!$key && /^(.*?)[:\.]\s*(.*)$/s) {
             $key = $1;              $key = $1;
             $value=$_;              $value=$2;
             next;              next;
         }          }
         if ($key) {          if ($key) {
Line 199  sub GetTours { Line 199  sub GetTours {
 }  }
   
 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) 
                              VALUES ($title, 'Т', $ParentId)");                               VALUES ($title, 'Т', $ParentId, $TourNum)");
     $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) {
Line 227  MAIN: Line 227  MAIN:
     # Inherited fields for a Question      # Inherited fields for a Question
     #      #
     my %QuestionFields = ('Тип'=> 'Type', 'Вид'=> 'Type',       my %QuestionFields = ('Тип'=> 'Type', 'Вид'=> 'Type', 
                           'Автор' => 'Authors',                             'Автор' => 'Authors', 'Рейтинг'=>'Rating', 
                           'Источник' => 'Sources');                            'Источник' => 'Sources');
                                                       
                                               
Line 237  MAIN: Line 237  MAIN:
         or die "Can't connect to DB chgk\n";          or die "Can't connect to DB chgk\n";
           
     while ($source = shift) {      while ($source = shift) {
           my $TourNum=0;
         my($PlayedAt) = '';          my($PlayedAt) = '';
         my($QuestionId, $TourId, $TournamentId, $ParentId) = (0, 0, 0, 0);          my($QuestionId, $TourId, $TournamentId, $ParentId) = (0, 0, 0, 0);
         my($tournum, $qnum, $all_qnum) = (0, 0, 0);          my($tournum, $qnum, $all_qnum) = (0, 0, 0);
Line 281  MAIN: Line 282  MAIN:
                               WHERE Id=$TourId");                                WHERE Id=$TourId");
                 }                  }
                 $qnum = 0;                  $qnum = 0;
                 $TourId=CreateTour($dbh,$value,$TournamentId,\%TourDefaults);                  $TourNum++;
                   $TourId=CreateTour($dbh,$value,$TournamentId,$TourNum,
                                      \%TourDefaults);
                 %QuestionDefaults=%QuestionGlobalDefaults;                  %QuestionDefaults=%QuestionGlobalDefaults;
                 $QuestionId=0;                  $QuestionId=0;
                 next;                     next;   
Line 318  MAIN: Line 321  MAIN:
                 next;                  next;
             }              }
                           
             my @Fields = grep /$key/, keys %QuestionFields;              my @Fields = grep { $key =~ /$_/ } keys %QuestionFields;
   
             if (scalar @Fields) {              if (scalar @Fields) {
                 my $word = shift @Fields;                  my $word = shift @Fields;
Line 333  MAIN: Line 336  MAIN:
                 next;                  next;
             }              }
   
             @Fields = grep /$key/, keys %TourFields;              @Fields = grep { $key =~ /$_/ } keys %TourFields;
   
             if (scalar @Fields) {              if (scalar @Fields) {
                 my $word = shift @Fields;                  my $word = shift @Fields;

Removed from v.1.14  
changed lines
  Added in v.1.18


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