--- db/prgsrc/updateindex.pl 2002/11/09 01:46:24 1.8 +++ db/prgsrc/updateindex.pl 2003/04/14 20:06:59 1.9 @@ -58,7 +58,7 @@ createindex.pl(1) Boris Veytsman -=head1 $Id: updateindex.pl,v 1.8 2002/11/09 01:46:24 roma7 Exp $ +=head1 $Id: updateindex.pl,v 1.9 2003/04/14 20:06:59 roma7 Exp $ =cut @@ -88,6 +88,7 @@ MAIN: $REMOVE=1; } my($source) = $opt_i; + my $champ; my($depth, @depthId); my $filename; my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") @@ -103,12 +104,17 @@ MAIN: chomp; s/ //; next if (/^\s*$/); - if (s/^(\S+) *//) { # File found + if (s/^(\S+\.txt) *//) { # File found $filename = $1; $depth = -1; + $champ=1; } else { # Group found - $filename = ''; + if (s/^(\S+)//) + { $filename = $1;} + else + {$filename = ''} $depth = -2; + $champ=0; } s/^(\t*)//; $depth += length($1); @@ -120,7 +126,7 @@ MAIN: my $title = $_; my $ParentId = ($depth) ? $depthId[$depth - 1] : 0; my $Id = CheckId($dbh,$title,$ParentId,$decision,$filename); - if (!$Id || $filename) { + if (!$Id || $champ) { next; } $depthId[$depth] = $Id; @@ -146,16 +152,19 @@ sub CheckId { my $type; my $key; my $value; - my $Id = 0; - if ($filename) { + my $Id = 0; + if ($filename && $filename=~/\.txt/) { $type=$dbh->quote('þ'); - $key = "FileName"; - $value = $dbh->quote($filename); + } else {$type=$dbh->quote('ç');} + if ($filename) + { + $key = "FileName"; + $value = $dbh->quote($filename); } else { - $type=$dbh->quote('ç'); - $key = "Title"; - $value = $dbh->quote($title); + $key = "Title"; + $value = $dbh->quote($title); } + $title=$dbh->quote($title); my $sth = $dbh->prepare("SELECT Id FROM Tournaments WHERE $key=$value");