2 # script that correct the marcxml from in biblioitems
3 # Written by TG on 10/04/2006
11 use MARC::File::USMARC;
13 use Time::HiRes qw(gettimeofday);
15 my $starttime = gettimeofday;
17 my $dbh = C4::Context->dbh;
18 my $sth=$dbh->prepare("select biblionumber,marc from biblioitems ");
20 $dbh->do("LOCK TABLES biblioitems WRITE");
22 my $sth2 = $dbh->prepare("UPDATE biblioitems set marcxml=? where biblionumber=?" );
25 while (my ($biblionumber,$marc)=$sth->fetchrow ){
27 my $record = MARC::File::USMARC::decode($marc);
28 my $xml=$record->as_xml_record();
29 $sth2->execute($xml,$biblionumber);
31 print "." unless ($i % 100);
32 $timeneeded = gettimeofday - $starttime unless ($i % 5000);
33 print "$i records in $timeneeded s\n" unless ($i % 5000);
36 $dbh->do("UNLOCK TABLES ");
37 $timeneeded = gettimeofday - $starttime ;
38 print "$i records in $timeneeded s\n" ;