--- db/prgsrc/updatedb.pl 2000/10/19 03:05:39 1.7 +++ db/prgsrc/updatedb.pl 2000/10/19 03:28:25 1.8 @@ -22,7 +22,7 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.7 2000/10/19 03:05:39 boris Exp $ +=head1 $Id: updatedb.pl,v 1.8 2000/10/19 03:28:25 boris Exp $ =cut @@ -106,6 +106,7 @@ sub SelectGroup { print "[$arr[0]] $arr[1]\n"; } $ParentId = ; + chomp $ParentId; if (!$ParentId) { print "Пропускаем файл $source\n"; print STDERR "Файл $source отвергнут оператором\n"; @@ -115,7 +116,7 @@ sub SelectGroup { $sth = $dbh->prepare("INSERT INTO Tournaments (Title, Type, ParentId, FileName) VALUES ($TourName, 'Ч', $ParentId, - $source"); + $source)"); $sth->execute; my $TournamentId = $sth->{mysql_insertid}; return ($TournamentId,$ParentId); @@ -175,6 +176,24 @@ sub DeleteTournament { WHERE Id=$Id"); } } + +sub GetTours { + my ($dbh, $ParentId) = @_; + my (@arr, @Tours); + + my ($sth) = $dbh->prepare("SELECT Id FROM Tournaments + WHERE ParentId=$ParentId ORDER BY Id"); + + $sth->execute; + + while (@arr = $sth->fetchrow) { + push @Tours, $arr[0]; + } + + return @Tours; +} + + MAIN: { my($key, $value, $addition);