From cc3c9011e860f51072d426ab2174a6223ccbfcc9 Mon Sep 17 00:00:00 2001 From: kados Date: Fri, 31 Mar 2006 18:06:40 +0000 Subject: [PATCH] permits exporting bibliographic data as MARC from the command line. --- export/export.pl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 export/export.pl diff --git a/export/export.pl b/export/export.pl new file mode 100755 index 0000000000..9ac7c83c5b --- /dev/null +++ b/export/export.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl +## This script allows you to export a rel_2_2 bibliographic db in +#MARC21 format from the command line. +# +use HTML::Template; +use strict; +require Exporter; +use C4::Database; +use C4::Auth; +use C4::Interface::CGI::Output; +use C4::Output; # contains gettemplate +use C4::Biblio; +use CGI; +use C4::Auth; +my $outfile = $ARGV[0]; +open(OUT,">$outfile") or die $!; +my $query = new CGI; + my $start_bib = $query->param("start_bib"); + my $end_bib = $query->param("end_bib"); + my $dbh=C4::Context->dbh; + my $sth; + if ($start_bib && $end_bib) { + $sth=$dbh->prepare("select bibid from marc_biblio where bibid >=? and bibid <=? order by bibid"); + $sth->execute($start_bib,$end_bib); + } else { + $sth=$dbh->prepare("select bibid from marc_biblio order by bibid"); + $sth->execute(); + } + while (my ($bibid) = $sth->fetchrow) { + my $record = MARCgetbiblio($dbh,$bibid); + + print OUT $record->as_usmarc(); + } +close(OUT); -- 2.39.2