5 |
use DBI; |
use DBI; |
6 |
use Data::Dumper; |
use Data::Dumper; |
7 |
use Encode qw/from_to/; |
use Encode qw/from_to/; |
8 |
|
use Time::HiRes qw/time/; |
9 |
|
|
10 |
=head1 NAME |
=head1 NAME |
11 |
|
|
44 |
my $total = $sth->rows; |
my $total = $sth->rows; |
45 |
my $i = 1; |
my $i = 1; |
46 |
|
|
47 |
|
my $t = time(); |
48 |
|
|
49 |
while (my $row = $sth->fetchrow_hashref() ) { |
while (my $row = $sth->fetchrow_hashref() ) { |
50 |
|
|
51 |
warn "# row: ",Dumper($row) if ($c->{debug}); |
warn "# row: ",Dumper($row) if ($c->{debug}); |
76 |
|
|
77 |
} |
} |
78 |
|
|
|
print " ", int(( $i++ / $total) * 100), "%\n"; |
|
|
|
|
79 |
warn "# doc draft: ",$doc->dump_draft, "\n" if ($c->{debug}); |
warn "# doc draft: ",$doc->dump_draft, "\n" if ($c->{debug}); |
80 |
|
|
81 |
die "error: ", $node->status,"\n" unless (eval { $node->put_doc($doc) }); |
die "error: ", $node->status,"\n" unless (eval { $node->put_doc($doc) }); |
82 |
|
|
83 |
|
printf (" %d%% %.1f/s\n", int(( $i++ / $total) * 100), ( $i / (time() - $t) ) ); |
84 |
|
|
85 |
} |
} |