2 # script that correct the marcxml from in biblioitems
3 # Written by TG on 10/04/2006
6 # find Koha's Perl modules
7 # test carefully before changing this
9 eval { require "$FindBin::Bin/kohalib.pl" };
17 use MARC::File::USMARC;
19 use Time::HiRes qw(gettimeofday);
21 my $starttime = gettimeofday;
23 my $dbh = C4::Context->dbh;
24 my $sth=$dbh->prepare("select biblionumber,marc from biblioitems ");
26 $dbh->do("LOCK TABLES biblioitems WRITE");
28 my $sth2 = $dbh->prepare("UPDATE biblioitems set marcxml=? where biblionumber=?" );
31 while (my ($biblionumber,$marc)=$sth->fetchrow ){
33 my $record = MARC::File::USMARC::decode($marc);
34 my $xml=$record->as_xml_record();
35 $sth2->execute($xml,$biblionumber);
37 print "." unless ($i % 100);
38 $timeneeded = gettimeofday - $starttime unless ($i % 5000);
39 print "$i records in $timeneeded s\n" unless ($i % 5000);
42 $dbh->do("UNLOCK TABLES ");
43 $timeneeded = gettimeofday - $starttime ;
44 print "$i records in $timeneeded s\n" ;