From 88f41fb97e6bc3f8caa5c9c770da22fd53a14013 Mon Sep 17 00:00:00 2001 From: tgarip1957 Date: Mon, 10 Apr 2006 21:11:58 +0000 Subject: [PATCH] Use this script to change all the xml in biblioitems. No more collection wrapper in XML. Biblio.pm changed. --- misc/xmlintobiblioitems.pl | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 misc/xmlintobiblioitems.pl diff --git a/misc/xmlintobiblioitems.pl b/misc/xmlintobiblioitems.pl new file mode 100644 index 0000000000..d302fd3a09 --- /dev/null +++ b/misc/xmlintobiblioitems.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# script that correct the marcxml from in biblioitems +# Written by TG on 10/04/2006 +use strict; + +# Koha modules used + +use C4::Context; +use C4::Biblio; +use MARC::Record; +use MARC::File::USMARC; +use MARC::File::XML; +use Time::HiRes qw(gettimeofday); + +my $starttime = gettimeofday; +my $timeneeded; +my $dbh = C4::Context->dbh; +my $sth=$dbh->prepare("select biblionumber,marc from biblioitems "); + $sth->execute(); + $dbh->do("LOCK TABLES biblioitems WRITE"); +my $i=0; +my $sth2 = $dbh->prepare("UPDATE biblioitems set marcxml=? where biblionumber=?" ); + + +while (my ($biblionumber,$marc)=$sth->fetchrow ){ + + my $record = MARC::File::USMARC::decode($marc); +my $xml=$record->as_xml_record(); +$sth2->execute($xml,$biblionumber); + + print "." unless ($i % 100); +$timeneeded = gettimeofday - $starttime unless ($i % 5000); + print "$i records in $timeneeded s\n" unless ($i % 5000); + $i++; +} +$dbh->do("UNLOCK TABLES "); +$timeneeded = gettimeofday - $starttime ; + print "$i records in $timeneeded s\n" ; + +END; \ No newline at end of file -- 2.39.2