version 1.36, 2003/04/14 20:06:59
|
version 1.43, 2008/11/14 11:23:03
|
Line 156 sub SelectGroup {
|
Line 156 sub SelectGroup {
|
print UNSORTED "$tempsource".((12 -length($source))x' ')."\t$temptname\n"; |
print UNSORTED "$tempsource".((12 -length($source))x' ')."\t$temptname\n"; |
$isunsorted=1; |
$isunsorted=1; |
$sth = $dbh->prepare("INSERT INTO Tournaments |
$sth = $dbh->prepare("INSERT INTO Tournaments |
(Title, Type, ParentId, FileName) |
(Title, Type, ParentId, FileName,CreatedAt) |
VALUES ($TourName, 'Ч', $ParentId, |
VALUES ($TourName, 'Ч', $ParentId, |
$source)"); |
$source,NOW())"); |
$sth->execute; |
$sth->execute; |
my $TournamentId = $sth->{mysql_insertid}; |
my $TournamentId = $sth->{mysql_insertid}; |
return ($TournamentId,$ParentId); |
return ($TournamentId,$ParentId); |
Line 175 sub UpdateTournament {
|
Line 175 sub UpdateTournament {
|
|
|
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; |
Line 242 sub GetTours {
|
Line 246 sub GetTours {
|
sub CreateTour { |
sub CreateTour { |
my ($dbh,$title,$ParentId,$TourNum,$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, Number) |
(Title, Type, ParentId, Number,CreatedAt) |
VALUES ($title, 'Т', $ParentId, $TourNum)"); |
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) { |
Line 277 MAIN:
|
Line 281 MAIN:
|
|
|
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; |
my @sources; |
open UNSORTED, ">$unsortedname"; |
open UNSORTED, ">$unsortedname"; |
while ($source = shift) { |
while ($source = shift) { |
Line 372 MAIN:
|
Line 377 MAIN:
|
next; |
next; |
} |
} |
|
|
|
|
|
if ($key =~ /Зач[её]т/) { |
|
&UpdateQuestion($dbh, $QuestionId, "PassCriteria", $value); |
|
next; |
|
} |
|
|
|
|
|
|
if ($key =~ /Комментари/) { |
if ($key =~ /Комментари/) { |
&UpdateQuestion($dbh, $QuestionId, "Comments", $value); |
&UpdateQuestion($dbh, $QuestionId, "Comments", $value); |
next; |
next; |
} |
} |
|
|
|
|
|
|
my @Fields = grep { $key =~ /$_/ } keys %QuestionFields; |
my @Fields = grep { $key =~ /$_/ } keys %QuestionFields; |
|
|