corrected init script name for apache2
[koha.git] / misc / xmlintobiblioitems.pl
blobd302fd3a09100dd5803a34e35e3ef83e90f2a8ad
1 #!/usr/bin/perl
2 # script that correct the marcxml from in biblioitems
3 # Written by TG on 10/04/2006
4 use strict;
6 # Koha modules used
8 use C4::Context;
9 use C4::Biblio;
10 use MARC::Record;
11 use MARC::File::USMARC;
12 use MARC::File::XML;
13 use Time::HiRes qw(gettimeofday);
15 my $starttime = gettimeofday;
16 my $timeneeded;
17 my $dbh = C4::Context->dbh;
18 my $sth=$dbh->prepare("select biblionumber,marc from biblioitems ");
19 $sth->execute();
20 $dbh->do("LOCK TABLES biblioitems WRITE");
21 my $i=0;
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);
34 $i++;
36 $dbh->do("UNLOCK TABLES ");
37 $timeneeded = gettimeofday - $starttime ;
38 print "$i records in $timeneeded s\n" ;
40 END;