15 |
=cut |
=cut |
16 |
|
|
17 |
my $c = { |
my $c = { |
18 |
node_url => 'http://localhost:1978/node/dbi', |
node_url => 'http://localhost:1978/node/dbi-template1', |
19 |
dbi => 'Pg:dbname=azop', |
dbi => 'Pg:dbname=template1', |
20 |
|
dbuser => 'postgres', |
21 |
sql => qq{ |
sql => qq{ |
22 |
select * from history_collection_view_cache |
select * from pg_database |
23 |
}, |
}, |
24 |
pk_col => '_id', |
pk_col => 'datname', |
25 |
db_encoding => 'iso-8859-2', |
db_encoding => 'iso-8859-2', |
26 |
debug => 0, |
debug => 0, |
27 |
user => 'admin', |
estuser => 'admin', |
28 |
passwd => 'admin', |
estpasswd => 'admin', |
29 |
|
quiet => 0, |
30 |
}; |
}; |
31 |
|
|
32 |
GetOptions($c, qw/node_url=s sql=s pk_col=s eb_encoding=s debug+ estuser=s estpasswd=s dbuser=s dbpasswd=s/); |
GetOptions($c, qw/node_url=s dbi=s sql=s pk_col=s eb_encoding=s debug+ quiet+ estuser=s estpasswd=s dbuser=s dbpasswd=s/); |
33 |
|
|
34 |
warn "# c: ", Dumper($c) if ($c->{debug}); |
warn "# c: ", Dumper($c) if ($c->{debug}); |
35 |
|
|
70 |
die "can't find pk_col column '$pk_col' in results\n"; |
die "can't find pk_col column '$pk_col' in results\n"; |
71 |
} |
} |
72 |
|
|
73 |
printf "%4d ",$i; |
my $out = ''; |
74 |
|
$out .= sprintf("%4d ",$i); |
75 |
|
|
76 |
while (my ($col,$val) = each %{$row}) { |
while (my ($col,$val) = each %{$row}) { |
77 |
|
|
85 |
# add body text to document (make it searchable using full-text index) |
# add body text to document (make it searchable using full-text index) |
86 |
$doc->add_text($val); |
$doc->add_text($val); |
87 |
|
|
88 |
print "R"; |
$out .= "R"; |
89 |
} else { |
} else { |
90 |
print "."; |
$out .= "."; |
91 |
} |
} |
92 |
|
|
93 |
} |
} |
96 |
|
|
97 |
die "error: ", $node->status,"\n" unless (eval { $node->put_doc($doc) }); |
die "error: ", $node->status,"\n" unless (eval { $node->put_doc($doc) }); |
98 |
|
|
99 |
printf (" %d%% %.1f/s\n", int(( $i++ / $total) * 100), ( $i / (time() - $t) ) ); |
printf ("%s %d%% %.1f/s\n", $out, int(( $i++ / $total) * 100), ( $i / (time() - $t) ) ) unless ($c->{quiet}); |
100 |
|
|
101 |
} |
} |