version 1.2, 2001/05/18 02:10:15
|
version 1.5, 2001/05/18 03:02:01
|
Line 10 use vars qw(@ISA @EXPORT);
|
Line 10 use vars qw(@ISA @EXPORT);
|
my $z; |
my $z; |
my $qbase; |
my $qbase; |
BEGIN {do "chgk.cnf"; |
BEGIN {do "chgk.cnf"; |
$qbase = DBI -> connect ("DBI:mysql:$base",undef,undef); |
$qbase = DBI -> connect ("DBI:mysql:$base",'piataev',''); |
}; |
}; |
|
|
|
|
Line 18 BEGIN {do "chgk.cnf";
|
Line 18 BEGIN {do "chgk.cnf";
|
sub getbase |
sub getbase |
{ |
{ |
my $a=join(", ",@_); |
my $a=join(", ",@_); |
$z= $qbase -> prepare("select $a FROM questions WHERE QuestionId<=$qnumber"); |
$z= $qbase -> prepare("select $a FROM Questions WHERE QuestionId<=$qnumber"); |
$z -> execute; |
$z -> execute; |
} |
} |
|
|
Line 26 sub getbase
|
Line 26 sub getbase
|
sub getquestion |
sub getquestion |
{ |
{ |
my $a=shift; |
my $a=shift; |
$z= $qbase -> prepare("select Question, Answer, Comments FROM questions WHERE QuestionId=$a"); |
$z= $qbase -> prepare("select Question, Answer, Comments FROM Questions WHERE QuestionId=$a"); |
$z -> execute; |
$z -> execute; |
$z -> fetchrow; |
$z -> fetchrow; |
} |
} |
Line 73 sub in2out
|
Line 73 sub in2out
|
|
|
|
|
$z= $qbase -> prepare ( "select t2.Id, t2.Number, t3.FileName |
$z= $qbase -> prepare ( "select t2.Id, t2.Number, t3.FileName |
from questions AS t1, tournaments AS t2 , tournaments AS t3 |
from Questions AS t1, Tournaments AS t2 , Tournaments AS t3 |
where (t1.QuestionId = $qid) && (t1.ParentId = t2.Id) && (t2.ParentId = t3.Id) "); |
where (t1.QuestionId = $qid) && (t1.ParentId = t2.Id) && (t2.ParentId = t3.Id) "); |
|
|
$z -> execute; |
$z -> execute; |
($tourid, $tourname, $filename)= $z -> fetchrow; |
($tourid, $tourname, $filename)= $z -> fetchrow; |
|
|
|
|
$z= $qbase -> prepare("select QuestionId from questions WHERE ParentId = $tourid"); |
$z= $qbase -> prepare("select QuestionId from Questions WHERE ParentId = $tourid"); |
|
|
$z -> execute; |
$z -> execute; |
my $i; |
my $i; |
Line 102 sub out2in
|
Line 102 sub out2in
|
# |
# |
|
|
|
|
$z= $qbase -> prepare ( "select q.QuestionId from questions as q, |
$z= $qbase -> prepare ( "select q.QuestionId from Questions as q, |
tournaments as t1, tournaments as t2 |
Tournaments as t1, Tournaments as t2 |
where (t2.FileName= \"$q[0]\") && |
where (t2.FileName= \"$q[0]\") && |
(t1.ParentId = t2.Id) && |
(t1.ParentId = t2.Id) && |
(q.ParentId = t1.Id) && |
(q.ParentId = t1.Id) && |