--- db/prgsrc/db.cgi 2001/12/10 21:28:33 1.48 +++ db/prgsrc/db.cgi 2001/12/13 00:01:58 1.51 @@ -74,7 +74,7 @@ sub GetTournament { foreach $name (@{$sth->{NAME}}) { $Tournament{$name} = $arr[$i++]; } - + $sth->finish; return %Tournament; } @@ -95,6 +95,7 @@ sub GetQuestion { $Question{$name} = $arr[$i++]; } + $sth->finish; return %Question; } @@ -104,7 +105,7 @@ sub GetTourQuestions { my (@arr, @Questions); my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions - WHERE ParentId=$ParentId ORDER BY QuestionId"); + WHERE ParentId=$ParentId"); $sth->execute; @@ -112,6 +113,7 @@ sub GetTourQuestions { push @Questions, $arr[0]; } + $sth->finish; return @Questions; } @@ -128,7 +130,7 @@ sub GetTours { while (@arr = $sth->fetchrow) { push @Tours, $arr[0]; } - + $sth->finish; return @Tours; } @@ -142,6 +144,7 @@ print "timeb=".time.br if $debug; $sth->execute; my @a=$sth->fetchrow; print "timee0=".time.br if $debug; + $sth->finish; $a[0]||0; } @@ -154,6 +157,11 @@ sub printform -default=>param('sstr')||'', -size=>30, -maxlength=>30); + my $qnumber="Выводить по".br. textfield(-name=>'kvo', + -default=>param('kvo')||'150', + -size=>3, + -maxlength=>5). br."вопросов"; + my @df=keys %searchin; @df=('Question', 'Answer') unless @df; my $fields=checkbox_group('searchin',['Question','Answer','Comments','Authors','Sources'], [@df], @@ -176,7 +184,8 @@ table(Tr ( td({-valign=>'TOP'},$inputstring.$submit.p."Метод: $metod".p."Слова: $all"), td({-valign=>'TOP'},(' 'x 8).'Поля:'), - td({-valign=>'TOP'},$fields) + td({-valign=>'TOP'},$fields), td(" "x5), + td({-valign=>'TOP'},$qnumber) ) ) @@ -267,6 +276,7 @@ print "$query",br if $printqueries; { push (@{$nf[$i]},$arr[0]) } + $sth->finish; } @@ -313,6 +323,7 @@ print STDERR "!$query\n",br if $printque { @blob=(@blob,unpack 'C*',$arr[0]); } + $sth->finish; $query="select number from nf where ".(join ' OR ', @arr1); print "$query\n",br if $printqueries; $sth=$dbh -> prepare($query); @@ -322,7 +333,7 @@ print "$query\n",br if $printqueries; { $frequence[$i]+=$arr[0]; } - + $sth->finish; if (@blob < 4) @@ -529,7 +540,7 @@ print $query if $printqueries; while (@arr = $sth->fetchrow) { push @Questions, $arr[0] unless $forbidden{$arr[0]}; } - + $sth->finish; print "@Questions" if $printqueries; return @Questions; } @@ -553,7 +564,7 @@ sub PrintList { my ($dbh,$Questions,$shablon)=@_; my $first=param('first') ||1; - my $kvo=param('kvo') ||30; + my $kvo=param('kvo') ||150; $first=$first-($first-1)%$kvo; my $last=$first+$kvo-1; @@ -563,8 +574,8 @@ sub PrintList { my $qs=query_string; $qs=~s/\;/\&/g; $qs=~s/\&first\=[^\&]+//g; - - + my $sstr=param('sstr'); + $qs=~s/sstr=[^\&]+/sstr=$sstr/; if ($first>$kvo*3+1) { $nav.= @@ -1034,6 +1045,7 @@ sub Get12Random { $sth->execute; $t = ($sth->fetchrow)[0]; } until !$chosen{$q} && $t && $type =~ /[$t]/; + $sth->finish; $chosen{$q} = 'y'; push @questions, $q; } @@ -1125,6 +1137,7 @@ sub PrintDates { " " . a({href=>url . "?tour=$Tournament{'Id'}&answer=0"}, $Tournament{'Title'}, $Tournament{'PlayedAt'})); } + $sth->finish; $output .= dl($list); return $output; } @@ -1144,6 +1157,7 @@ sub PrintQOfAuthor my @Questions; while (($q)=$sth->fetchrow,$q) {push @Questions,$q unless $forbidden{$q}} + $sth->finish; my ($output, $i, $suffix, $hits) = ('', 0, '', $#Questions + 1); @@ -1217,6 +1231,7 @@ a({href=>url."?authors=surname"},"фамили } } $output.=""; + $sth->finish; return $output; } @@ -1313,6 +1328,7 @@ print $query if $printqueries; my $sth=$dbh->prepare($query); $sth->execute; my $sstr= join ' ',$sth->fetchrow; + $sth->finish; $searchin{'Question'}=1; $searchin{'Answer'}=1; $sstr=~tr/ёЁ/еЕ/; @@ -1355,6 +1371,7 @@ $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит WHERE FileName = '$tour.txt'"); $sth->execute; $tour = ($sth->fetchrow)[0]; + $sth->finish; } print &PrintTournament($dbh, $tour, param('answer')); }