5 use lib '/openils/lib/perl5/';
8 use OpenSRF::EX qw/:try/;
9 use OpenSRF::AppSession;
10 use OpenSRF::Application;
11 use OpenSRF::MultiSession;
12 use OpenSRF::Utils::SettingsClient;
13 use OpenILS::Application::Storage;
14 use OpenILS::Application::AppUtils;
15 use OpenILS::Utils::Fieldmapper;
16 use Digest::MD5 qw/md5_hex/;
17 use OpenSRF::Utils::JSON;
21 use Time::HiRes qw/time/;
27 MARC::Charset->ignore_errors(1);
30 my ($type, $config, $autoprimary) =
31 ('biblio.record_entry', '/openils/conf/opensrf_core.xml', 0);
35 'config=s' => \$config,
36 'autoprimary' => \$config,
40 OpenSRF::System->bootstrap_client( config_file => $config );
41 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
43 OpenILS::Application::Storage->use;
44 OpenILS::Application::Storage->initialize;
45 OpenILS::Application::Storage->child_init || die;
48 OpenILS::Application::Storage->autoprimary(1);
51 my $base = "open-ils.storage.direct.$type.batch.create";
53 OpenSRF::Application->method_lookup( "$base.start" )->run;
57 while ( my $rec = <> ) {
60 my $row = OpenSRF::Utils::JSON->JSON2perl($rec);
62 OpenSRF::Application->method_lookup( "$base.push" )->run($row);
66 print STDERR "\r$count\t". $count / (time - $starttime);
71 last if ($count > 10000);
74 #OpenSRF::Application->method_lookup( "$base.finish" )->run;