8 use Data::Dump qw/dump/;
10 my $limit = $ENV{LIMIT} || 9999;
12 my $dsn = 'DBI:mysql:dbname=koha_ffzg';
15 biblionumber,itemnumber,title,
19 join biblioitems using (biblionumber)
20 join biblio using (biblionumber)
21 where location = 'MKP'
27 my $path = "/dev/shm/$1" if $dsn =~ m/=(.+)/;
29 open(my $marc_fh, '>', "$path.marc");
30 open(my $tsv_fh, '>', "$path.tsv");
33 my $dbh = DBI->connect( $dsn, '', '', { RaiseError => 1 } ) || die $DBI::errstr;
34 #$dbh->do( qq{ set client_encoding='utf-8' } );
37 my $sth = $dbh->prepare( $sql );
40 warn "# ", $sth->rows,"\n";
41 my @cols = @{ $sth->{NAME} };
42 print $tsv_fh "#", join("\t", 'offset', @cols), "\n";
46 while ( my $row = $sth->fetchrow_hashref ) {
48 warn "# row = ",dump( $row );
50 my $rec = tell $marc_fh;
55 print $marc_fh $row->{marc};
63 print $tsv_fh "$rec\n";
66 warn "# rows ", $sth->rows,"\n";
67 system "ls -al $path*";
68 system "rsync -v $path* 10.60.0.82:/tmp/";