Diff for /db/prgsrc/db.cgi between versions 1.48 and 1.49

version 1.48, 2001/12/10 21:28:33 version 1.49, 2001/12/11 12:19:31
Line 70  sub GetTournament { Line 70  sub GetTournament {
         $sth->execute;          $sth->execute;
   
         @arr = $sth->fetchrow;          @arr = $sth->fetchrow;
           $sth->finish;
         my($i, $name) = 0;          my($i, $name) = 0;
         foreach $name (@{$sth->{NAME}}) {          foreach $name (@{$sth->{NAME}}) {
                 $Tournament{$name} = $arr[$i++];                  $Tournament{$name} = $arr[$i++];
Line 95  sub GetQuestion { Line 96  sub GetQuestion {
                 $Question{$name} = $arr[$i++];                  $Question{$name} = $arr[$i++];
         }          }
   
           $sth->finish;
         return %Question;          return %Question;
 }  }
   
Line 112  sub GetTourQuestions { Line 114  sub GetTourQuestions {
                 push @Questions, $arr[0];                  push @Questions, $arr[0];
         }          }
   
           $sth->finish;
         return @Questions;          return @Questions;
 }  }
   
Line 128  sub GetTours { Line 131  sub GetTours {
         while (@arr = $sth->fetchrow) {          while (@arr = $sth->fetchrow) {
                 push @Tours, $arr[0];                  push @Tours, $arr[0];
         }          }
           $sth->finish;
         return @Tours;          return @Tours;
 }  }
   
Line 142  print "timeb=".time.br if $debug; Line 145  print "timeb=".time.br if $debug;
   $sth->execute;    $sth->execute;
   my @a=$sth->fetchrow;    my @a=$sth->fetchrow;
 print "timee0=".time.br if $debug;  print "timee0=".time.br if $debug;
     $sth->finish;
   $a[0]||0;    $a[0]||0;
 }  }
   
Line 267  print "$query",br if $printqueries; Line 271  print "$query",br if $printqueries;
                 {                  {
                    push (@{$nf[$i]},$arr[0])                     push (@{$nf[$i]},$arr[0])
                 }                  }
                   $sth->finish;
             }              }
   
   
Line 313  print STDERR "!$query\n",br if $printque Line 318  print STDERR "!$query\n",br if $printque
               {                {
                 @blob=(@blob,unpack 'C*',$arr[0]);                  @blob=(@blob,unpack 'C*',$arr[0]);
               }                }
                 $sth->finish;
               $query="select number from nf where ".(join ' OR ', @arr1);                $query="select number from nf where ".(join ' OR ', @arr1);
 print "$query\n",br if $printqueries;  print "$query\n",br if $printqueries;
               $sth=$dbh -> prepare($query);                $sth=$dbh -> prepare($query);
Line 322  print "$query\n",br if $printqueries; Line 328  print "$query\n",br if $printqueries;
               {                {
                 $frequence[$i]+=$arr[0];                  $frequence[$i]+=$arr[0];
               }                }
                 $sth->finish;
   
   
               if (@blob < 4)                if (@blob < 4)
Line 529  print $query if $printqueries; Line 535  print $query if $printqueries;
         while (@arr = $sth->fetchrow) {          while (@arr = $sth->fetchrow) {
                 push @Questions, $arr[0] unless $forbidden{$arr[0]};                  push @Questions, $arr[0] unless $forbidden{$arr[0]};
         }          }
           $sth->finish;
 print "@Questions" if $printqueries;  print "@Questions" if $printqueries;
         return @Questions;          return @Questions;
 }  }
Line 1034  sub Get12Random { Line 1040  sub Get12Random {
            $sth->execute;             $sth->execute;
            $t = ($sth->fetchrow)[0];             $t = ($sth->fetchrow)[0];
        } until !$chosen{$q} && $t && $type =~ /[$t]/;         } until !$chosen{$q} && $t && $type =~ /[$t]/;
          $sth->finish;
        $chosen{$q} = 'y';         $chosen{$q} = 'y';
        push @questions, $q;         push @questions, $q;
    }     }
Line 1125  sub PrintDates { Line 1132  sub PrintDates {
       " " . a({href=>url . "?tour=$Tournament{'Id'}&answer=0"},        " " . a({href=>url . "?tour=$Tournament{'Id'}&answer=0"},
       $Tournament{'Title'}, $Tournament{'PlayedAt'}));        $Tournament{'Title'}, $Tournament{'PlayedAt'}));
         }          }
           $sth->finish;
         $output .= dl($list);          $output .= dl($list);
         return $output;          return $output;
 }  }
Line 1144  sub PrintQOfAuthor Line 1152  sub PrintQOfAuthor
     my @Questions;      my @Questions;
     while (($q)=$sth->fetchrow,$q)      while (($q)=$sth->fetchrow,$q)
      {push @Questions,$q unless $forbidden{$q}}       {push @Questions,$q unless $forbidden{$q}}
       $sth->finish;
   
     my ($output, $i, $suffix, $hits) = ('', 0, '', $#Questions + 1);      my ($output, $i, $suffix, $hits) = ('', 0, '', $#Questions + 1);
   
Line 1217  a({href=>url."?authors=surname"},"ÆÁÍÉÌÉ Line 1226  a({href=>url."?authors=surname"},"ÆÁÍÉÌÉ
            }             }
      }       }
      $output.="</TABLE>";       $output.="</TABLE>";
        $sth->finish;
      return $output;       return $output;
 }  }
   
Line 1313  print $query if $printqueries; Line 1323  print $query if $printqueries;
               my $sth=$dbh->prepare($query);                my $sth=$dbh->prepare($query);
               $sth->execute;                $sth->execute;
               my $sstr= join ' ',$sth->fetchrow;                my $sstr= join ' ',$sth->fetchrow;
                 $sth->finish;
               $searchin{'Question'}=1;                $searchin{'Question'}=1;
               $searchin{'Answer'}=1;                $searchin{'Answer'}=1;
       $sstr=~tr/£³/Åå/;        $sstr=~tr/£³/Åå/;
Line 1355  $sstr=~s/[^ÊÃÕËÅÎÇÛÝÚÈßÆÙ×ÁÐÒÏÌÄÖÜÑÞÓÍÉÔ Line 1366  $sstr=~s/[^ÊÃÕËÅÎÇÛÝÚÈßÆÙ×ÁÐÒÏÌÄÖÜÑÞÓÍÉÔ
                         WHERE FileName = '$tour.txt'");                          WHERE FileName = '$tour.txt'");
                         $sth->execute;                          $sth->execute;
                         $tour = ($sth->fetchrow)[0];                          $tour = ($sth->fetchrow)[0];
                           $sth->finish;
                 }                  }
                 print &PrintTournament($dbh, $tour, param('answer'));                  print &PrintTournament($dbh, $tour, param('answer'));
         }          }

Removed from v.1.48  
changed lines
  Added in v.1.49


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