]> git.koha-community.org Git - koha.git/blob - misc/exportauth.pl
Merge branch 'master' of http://manage-gmc.dev.kohalibrary.com/koha-installer
[koha.git] / misc / exportauth.pl
1 #!/usr/bin/perl
2 ## This script allows you to export a rel_2_2 bibliographic db in 
3 #MARC21 format from the command line.
4 #
5
6 use strict;
7 BEGIN {
8     # find Koha's Perl modules
9     # test carefully before changing this
10     use FindBin;
11     eval { require "$FindBin::Bin/kohalib.pl" };
12 }
13 require Exporter;
14
15 use C4::Auth;
16 use C4::Output;  # contains gettemplate
17 use C4::Biblio;
18 use CGI;
19 use C4::Auth;
20 my $outfile = $ARGV[0];
21 open(OUT,">$outfile") or die $!;
22 my $query = new CGI;
23 my $dbh=DBI->connect("DBI:mysql:database=koha2;host=localhost;port=3306","kohaserver","kohaserver") or die $DBI::errmsg;
24 #$dbh->do("set character_set_client='latin5'"); 
25 #$dbh->do("set character_set_connection='utf8'");
26 #$dbh->do("set character_set_results='latin5'");                
27 #my $dbh=C4::Context->dbh;
28         my $sth;
29         
30                 $sth=$dbh->prepare("select marc from auth_header order by authid");
31                 $sth->execute();
32         
33         while (my ($marc) = $sth->fetchrow) {
34
35                 print OUT $marc;
36         }
37 close(OUT);