Bugzilla – Attachment 17847 Details for
Bug 10160
Add z39.50 command line tester
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10160 - Add z39.50 command line tester
Bug-10160---Add-z3950-command-line-tester.patch (text/plain), 3.34 KB, created by
Kyle M Hall
on 2013-04-30 16:08:43 UTC
(
hide
)
Description:
Bug 10160 - Add z39.50 command line tester
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-04-30 16:08:43 UTC
Size:
3.34 KB
patch
obsolete
>From 99074036ddb3ac34b67ff1844a07641dcb1510e4 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersoltuions.com> >Date: Tue, 30 Apr 2013 12:15:37 -0400 >Subject: [PATCH] Bug 10160 - Add z39.50 command line tester > >--- > misc/z3950_test.pl | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 120 insertions(+), 0 deletions(-) > create mode 100644 misc/z3950_test.pl > >diff --git a/misc/z3950_test.pl b/misc/z3950_test.pl >new file mode 100644 >index 0000000..38f8b1e >--- /dev/null >+++ b/misc/z3950_test.pl >@@ -0,0 +1,120 @@ >+#!/usr/bin/perl >+ >+use strict; >+use warnings; >+ >+use Getopt::Long; >+use List::Util qw/min/; >+use ZOOM; >+ >+# command-line parameters >+my $host = undef; >+my $port = undef; >+my $database = undef; >+my $verbose = 0; >+my ( $isbn, $issn, $title, $author, $dewey, $subject, $lccn, $lccall, $controlnumber, $stdid, $srchany ); >+ >+my $result = GetOptions( >+ 'h|host=s' => \$host, >+ 'p|port=s' => \$port, >+ 'd|database=s' => \$database, >+ >+ 'isbn=s' => \$isbn, >+ 'issn=s' => \$issn, >+ 'title=s' => \$title, >+ 'author=s' => \$author, >+ 'dewey=s' => \$dewey, >+ 'subject=s' => \$subject, >+ 'lccn=s' => \$lccn, >+ 'lccall=s' => \$lccall, >+ 'controlnumber=s' => \$controlnumber, >+ 'stdid=s' => \$stdid, >+ 'srchany=s' => \$srchany, >+ >+ 'v|verbose' => \$verbose, >+); >+ >+die("Error: missing required options") unless ( $host && $port && $database ); >+ >+print "\n"; >+print "Using host '$host'\n"; >+print "Using port '$port'\n"; >+print "Using database '$database'\n"; >+print "\n"; >+ >+my $query = ''; >+my $nterms; >+if ($isbn) { >+ $query .= " \@attr 1=7 \@attr 5=1 \"$isbn\" "; >+ $nterms++; >+} >+if ($issn) { >+ $query .= " \@attr 1=8 \@attr 5=1 \"$issn\" "; >+ $nterms++; >+} >+if ($title) { >+ utf8::decode($title); >+ $query .= " \@attr 1=4 \"$title\" "; >+ $nterms++; >+} >+if ($author) { >+ utf8::decode($author); >+ $query .= " \@attr 1=1003 \"$author\" "; >+ $nterms++; >+} >+if ($dewey) { >+ $query .= " \@attr 1=16 \"$dewey\" "; >+ $nterms++; >+} >+if ($subject) { >+ utf8::decode($subject); >+ $query .= " \@attr 1=21 \"$subject\" "; >+ $nterms++; >+} >+if ($lccn) { >+ $query .= " \@attr 1=9 $lccn "; >+ $nterms++; >+} >+if ($lccall) { >+ $query .= " \@attr 1=16 \@attr 2=3 \@attr 3=1 \@attr 4=1 \@attr 5=1 \@attr 6=1 \"$lccall\" "; >+ $nterms++; >+} >+if ($controlnumber) { >+ $query .= " \@attr 1=12 \"$controlnumber\" "; >+ $nterms++; >+} >+if ($stdid) { >+ $query .= " \@attr 1=1007 \"$stdid\" "; >+ $nterms++; >+} >+if ($srchany) { >+ $query .= " \@attr 1=1016 \"$srchany\" "; >+ $nterms++; >+} >+for my $i ( 1 .. $nterms - 1 ) { >+ $query = "\@and " . $query; >+} >+warn "\nQUERY: $query\n\n"; >+ >+my ( $start_run, $end_run ); >+ >+my $conn = new ZOOM::Connection( $host, $port, databaseName => $database ); >+$conn->option( preferredRecordSyntax => "usmarc" ); >+$start_run = time(); >+my $rs = $conn->search_pqf($query); >+my $n = $rs->size(); >+ >+## Koha only display 20 results per page, so set >+## $i to no more than 20 >+for ( my $i = 0 ; $i < min( $n, 20 ) ; $i++ ) { >+ my $record = $rs->record($i)->render(); >+ print "\n$record\n" if $verbose; >+} >+ >+$end_run = time(); >+ >+print "\nRecieved $n results\n"; >+ >+my $run_time = $end_run - $start_run; >+print "\nSearch took $run_time seconds\n\n"; >+ >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10160
: 17847