[Koha-cvs] koha/z3950 processz3950queue [rel_2_2]
Joshua Ferraro
jmf at kados.org
Sun Jun 11 15:50:31 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Joshua Ferraro <kados> 06/06/11 13:50:31
Modified files:
z3950 : processz3950queue
Log message:
Updating to use new ZOOM API
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/z3950/processz3950queue?cvsroot=koha&only_with_tag=rel_2_2&r1=1.13.2.2&r2=1.13.2.3
Patches:
Index: processz3950queue
===================================================================
RCS file: /sources/koha/koha/z3950/processz3950queue,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -u -b -r1.13.2.2 -r1.13.2.3
--- processz3950queue 16 Jun 2005 15:51:05 -0000 1.13.2.2
+++ processz3950queue 11 Jun 2006 13:50:31 -0000 1.13.2.3
@@ -1,14 +1,14 @@
#!/usr/bin/perl
-# $Id: processz3950queue,v 1.13.2.2 2005/06/16 15:51:05 tipaul Exp $
-
+# $Id: processz3950queue,v 1.13.2.3 2006/06/11 13:50:31 kados Exp $
+use MARC::Record;
use C4::Context;
use DBI;
use strict;
use C4::Biblio;
use C4::Output;
use C4::Breeding;
-use Net::Z3950;
+use ZOOM;
=head1 NAME
@@ -208,7 +208,7 @@
} elsif ($type eq 'keyword') {
$attr='1=1016';
}
- my $query="\@attr $attr \"$term\"";
+ my $query = "\@attr $attr \"$term\"";
print "$$/$id : Processing $type=$term at $name $server $database $syntax (".($forkcounter+1)." forks)\n";
# try to connect
my $conn;
@@ -216,9 +216,9 @@
my $error=0;
# the z3950 query is builded. Launch it.
if ($user) {
- $conn= new Net::Z3950::Connection($servername, $port, databaseName => $database, user => $user, password => $password) || ($noconnection=1);
+ $conn= new ZOOM::Connection($servername, $port, databaseName => $database, user => $user, password => $password) || ($noconnection=1);
} else {
- $conn= new Net::Z3950::Connection($servername, $port, databaseName => $database) || ($noconnection=1);
+ $conn= new ZOOM::Connection($servername, $port, databaseName => $database) || ($noconnection=1);
}
if ($noconnection || $error) {
# if connection impossible, don't go further !
@@ -256,16 +256,17 @@
$stj->execute($resultsid);
#######
print "$$/$id : connected to $globalname\n";
+ print "Global Syntax =>".$globalsyntax."<=";
eval {$conn->option(elementSetName => 'F')};
- eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);} if ($globalsyntax eq "MARC21");
- eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::UNIMARC);} if ($globalsyntax eq "UNIMARC");
+ eval { $conn->option(preferredRecordSyntax => 'USMARC');} if ($globalsyntax eq "USMARC");
+ eval { $conn->option(preferredRecordSyntax => 'UNIMARC');} if ($globalsyntax eq "UNIMARC");
if ($@) {
print "$$/$id : $globalname ERROR: $@ for $resultsid\n";
# in case pb during connexion, set result to "empty" to avoid everlasting loops
my $stj=$dbi->prepare("update z3950results set numrecords=?,numdownloaded=?,highestseen=0,results='',enddate=? where id=?");
$stj->execute(0,0,$now,$resultsid);
} else {
- my $rs=$conn->search($query);
+ my $rs=$conn->search_pqf($query) or warn "Connection Problem:".$conn->errmsg();
pe();
# we have an answer for a query => get results & store them in marc_breeding table
my $numresults=$rs->size();
@@ -279,8 +280,10 @@
my $result='';
my $scantimerstart=time();
for ($i=1; $i<=(($numresults<80) ? ($numresults) : (80)); $i++) {
- my $rec=$rs->record($i);
- my $marcdata = $rec->rawdata();
+ my $rec=$rs->record($i-1);
+ my $marcdata = $rec->raw();
+ #my $marcrecord = MARC::Record->new_from_usmarc($marcdata);
+ #warn $marcrecord->as_formatted();
$globalencoding = ref($rec);
$result.=$marcdata;
}
More information about the Koha-cvs
mailing list