--- db/prgsrc/updatedb.pl 2003/01/09 01:43:21 1.31 +++ db/prgsrc/updatedb.pl 2003/02/24 13:59:27 1.35 @@ -28,13 +28,14 @@ The database, user and password are hard Dmitry Rubinstein -=head1 $Id: updatedb.pl,v 1.31 2003/01/09 01:43:21 boris Exp $ +=head1 $Id: updatedb.pl,v 1.35 2003/02/24 13:59:27 roma7 Exp $ =cut use vars qw($opt_i); use Getopt::Std; +my $unsortedname="../dump/unsorted"; getopts('i'); #open STDERR, ">errors"; my $Interactive=$opt_i || 0; @@ -89,6 +90,7 @@ sub getField { $value =~ s/-(.*)-/-$month-/; $value =~ s/-00*$/-01/; } + if ($key eq 'Автор') {$value=~s/\.$//;} $value = $dbh->quote($value); return ($key, $value); } @@ -144,7 +146,11 @@ sub SelectGroup { # Теперь, если файла нет в дереве турниров, никаких вопросов не # задаётся, а вместо этого он добавляется в группу 9999 $ParentId = 9999; - print UNSORTED "$source".((12 -length($source))x' ')."\t$TourName\n"; + my $tempsource=$source; + my $temptname=$TourName; + $tempsource=~s/^\'(.*)\'$/$1/; + $temptname=~s/^\'(.*)\'$/$1/; + print UNSORTED "$tempsource".((12 -length($source))x' ')."\t$temptname\n"; $isunsorted=1; $sth = $dbh->prepare("INSERT INTO Tournaments (Title, Type, ParentId, FileName) @@ -269,7 +275,7 @@ MAIN: my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") or die "Can't connect to DB chgk\n"; my @sources; - open UNSORTED, ">$DUMPDIR/unsorted"; + open UNSORTED, ">$unsortedname"; while ($source = shift) { push @sources,glob($source); } @@ -406,6 +412,6 @@ MAIN: print STDERR "Всего вопросов: $all_qnum \n"; } close UNSORTED; - unlink "unsorted" unless $isunsorted; + unlink $unsortedname unless $isunsorted; $dbh->disconnect; }