--- db/prgsrc/updatedb.pl 2004/01/11 00:14:32 1.39 +++ db/prgsrc/updatedb.pl 2008/11/14 11:23:03 1.43 @@ -28,7 +28,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.39 2004/01/11 00:14:32 boris Exp $ +=head1 $Id: updatedb.pl,v 1.43 2008/11/14 11:23:03 roma7 Exp $ =cut @@ -156,9 +156,9 @@ sub SelectGroup { print UNSORTED "$tempsource".((12 -length($source))x' ')."\t$temptname\n"; $isunsorted=1; $sth = $dbh->prepare("INSERT INTO Tournaments - (Title, Type, ParentId, FileName) + (Title, Type, ParentId, FileName,CreatedAt) VALUES ($TourName, 'þ', $ParentId, - $source)"); + $source,NOW())"); $sth->execute; my $TournamentId = $sth->{mysql_insertid}; return ($TournamentId,$ParentId); @@ -175,6 +175,10 @@ sub UpdateTournament { sub UpdateQuestion { my ($dbh, $QuestionId, $field, $value) = @_; + + if (($field eq 'Type') && ($value eq "'ä'")) { + $value = "'þä'"; + } $dbh->do("UPDATE Questions SET $field=$value WHERE QuestionId=$QuestionId") or die $dbh->errstr; @@ -242,8 +246,8 @@ sub GetTours { sub CreateTour { my ($dbh,$title,$ParentId,$TourNum,$rh_defaults)=@_; my $sth = $dbh->prepare("INSERT INTO Tournaments - (Title, Type, ParentId, Number) - VALUES ($title, 'ô', $ParentId, $TourNum)"); + (Title, Type, ParentId, Number,CreatedAt) + VALUES ($title, 'ô', $ParentId, $TourNum,NOW())"); $sth->execute; my $TourId = $sth->{mysql_insertid}; while (my ($key,$value)=each %$rh_defaults) { @@ -277,6 +281,7 @@ MAIN: my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") or die "Can't connect to DB chgk\n"; +if ($dbh->get_info( 18 )=~/^(5|(4.1))/) {$dbh->do("SET NAMES 'koi8r'");} my @sources; open UNSORTED, ">$unsortedname"; while ($source = shift) { @@ -385,14 +390,6 @@ MAIN: next; } - if ($key =~ /÷ÉÄ/) { - if ($value =~ /^\s*ä\s*$/) {#Questions ä are really þä... - $value = "þä"; - } - &UpdateQuestion($dbh, $QuestionId, "Type", $value); - next; - } - my @Fields = grep { $key =~ /$_/ } keys %QuestionFields;