X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FSpot.pm;fp=perl%2FSpot.pm;h=7fcba6d1d045a005d0693306a72b0d3a2307b9f3;hb=61885d0dba3c8e06146aabb40031609ef1eb5b2e;hp=b8efd3d17c7af576ef387c908e41acfbb3eef8d5;hpb=e1de45af27eb69a8b063a8a88401174cd95e9683;p=spider.git diff --git a/perl/Spot.pm b/perl/Spot.pm index b8efd3d1..7fcba6d1 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -111,10 +111,11 @@ sub init my $now = Julian::Day->alloc(1995, 0); my $today = Julian::Day->new(time); my $sth = $main::dbh->spot_insert_prepare; - $main::dbh->{RaiseError} = 0; while ($now->cmp($today) <= 0) { my $fh = $fp->open($now); if ($fh) { +# $main::dbh->{RaiseError} = 0; + $main::dbh->begin_work; my $count = 0; while (<$fh>) { chomp; @@ -125,31 +126,32 @@ sub init push @s, $b[1] if @s < 7; push @s, '' if @s < 8; push @s, @a[0,1], @b[0,1] if @s < 12; - push @s, $a[2], $a[2] if @s < 14; + push @s, $a[2], $a[2] if @s < 14; } - push @s, undef while @s < 14; - pop @s while @s > 14; - $main::dbh->spot_insert(\@s, $sth); $count++; } - $main::dbh->commit if $count; - $main::dbh->{RaiseError} = 0; + $main::dbh->commit; dbg("inserted $count spots from $now->[0] $now->[1]"); $fh->close; $total += $count; } $now = $now->add(1); } + $main::dbh->begin_work; $main::dbh->spot_add_indexes; $main::dbh->commit; - $main::dbh->{RaiseError} = 1; +# $main::dbh->{RaiseError} = 1; $t = time - $t; my $min = int($t / 60); my $sec = $t % 60; dbg("$total spots converted in $min:$sec"); } + unless ($main::dbh->has_ipaddr) { + $main::dbh->add_ipaddr; + dbg("added ipaddr field to spot table"); + } } } @@ -190,6 +192,7 @@ sub add my $buf = join('^', @_); $fp->writeunix($_[2], $buf); if ($main::dbh) { + $main::dbh->begin_work; $main::dbh->spot_insert(\@_); $main::dbh->commit; }