--- db/prgsrc/updatedb.pl 2000/10/20 01:45:46 1.10 +++ db/prgsrc/updatedb.pl 2000/10/20 03:18:38 1.11 @@ -22,7 +22,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.10 2000/10/20 01:45:46 boris Exp $ +=head1 $Id: updatedb.pl,v 1.11 2000/10/20 03:18:38 boris Exp $ =cut @@ -64,7 +64,7 @@ sub getField { my($key); my($value) = (''); while (<$desc>) { - s/ //g; + s/[ ]//g; if ($key && /^\s*$/) { chomp $value; chomp $key; @@ -249,7 +249,6 @@ MAIN: WHERE Id=$TourId"); } $qnum = 0; - $qtype = 'Ч'; $sth = $dbh->prepare("INSERT INTO Tournaments (Title, Type, ParentId, CreatedAt) VALUES ($value, 'Т', $TournamentId, @@ -264,6 +263,15 @@ MAIN: next; } if ($key =~ /Вопрос/) { + if (!$TourId) { + $qnum = 0; + $sth = $dbh->prepare("INSERT INTO Tournaments + (Title, Type, ParentId, CreatedAt) + VALUES ('1', 'Т', $TournamentId, + $CreatedAt)"); + $sth->execute; + $TourId = $sth->{mysql_insertid}; + } my $query = "INSERT INTO Questions (ParentId, Number, Type) VALUES ($TourId, $qnum+1, \'$qtype\')";