From 3253ded6f7e5fbd840152247ecc54f6e591feb6c Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 21 Jul 2006 22:14:05 +0000 Subject: [PATCH] Support for SCHEMA --- Changes | 3 ++- SimpleServer.pm | 4 +++- SimpleServer.xs | 13 ++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 00f7706..5ad5a37 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,4 @@ -$Id: Changes,v 1.24 2006-04-19 12:38:37 mike Exp $ +$Id: Changes,v 1.25 2006-07-21 22:14:05 mike Exp $ Revision history for Perl extension Net::Z3950::SimpleServer @@ -8,6 +8,7 @@ Revision history for Perl extension Net::Z3950::SimpleServer yaz_rpnquery_to_wrbuf() used instead. This is more robust in dealing with unusual cases such as string-valued attributes. + - Support for SCHEMA element when fetching records. 1.01 Fri Mar 24 12:09:32 GMT 2006 - Documentation of release 1.00's SRU/SRW facilities. diff --git a/SimpleServer.pm b/SimpleServer.pm index 1dc36d2..35f96f2 100644 --- a/SimpleServer.pm +++ b/SimpleServer.pm @@ -25,7 +25,7 @@ ## ## -## $Id: SimpleServer.pm,v 1.27 2006-06-02 16:03:25 quinn Exp $ +## $Id: SimpleServer.pm,v 1.28 2006-07-21 22:14:19 mike Exp $ package Net::Z3950::SimpleServer; @@ -538,6 +538,7 @@ The parameters exchanged between the server and the fetch handler are OFFSET => nnn ## Record offset number REQ_FORM => "n.m.k.l"## Client requested format OID COMP => "xyz" ## Formatting instructions + SCHEMA => "abc" ## Requested schema, if any ## Handler response: @@ -548,6 +549,7 @@ The parameters exchanged between the server and the fetch handler are ERR_STR => "" ## Error string SUR_FLAG => 0 ## Surrogate diagnostic flag REP_FORM => "n.m.k.l"## Provided format OID + SCHEMA => "abc" ## Provided schema, if any }; The REP_FORM value has by default the REQ_FORM value but can be set to diff --git a/SimpleServer.xs b/SimpleServer.xs index 012a301..c2fc4ec 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -1,5 +1,5 @@ /* - * $Id: SimpleServer.xs,v 1.48 2006-06-07 18:25:15 quinn Exp $ + * $Id: SimpleServer.xs,v 1.49 2006-07-21 22:14:12 mike Exp $ * ---------------------------------------------------------------------- * * Copyright (c) 2000-2004, Index Data. @@ -843,6 +843,7 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) SV *sur_flag; SV *point; SV *rep_form; + SV *schema; char *ptr; char *ODR_record; char *ODR_basename; @@ -865,6 +866,8 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) rr->errcode = 0; href = newHV(); hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0); + if (rr->schema) + hv_store(href, "SCHEMA", 6, newSVpv(rr->schema, 0), 0); temp = hv_store(href, "OFFSET", 6, newSViv(rr->number), 0); if (rr->request_format_raw != 0) { oid_dotted = oid2dotted(rr->request_format_raw); @@ -956,6 +959,9 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) temp = hv_fetch(href, "REP_FORM", 8, 1); rep_form = newSVsv(*temp); + temp = hv_fetch(href, "SCHEMA", 8, 1); + schema = newSVsv(*temp); + temp = hv_fetch(href, "HANDLE", 6, 1); point = newSVsv(*temp); @@ -967,6 +973,10 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) strcpy(ODR_basename, ptr); rr->basename = ODR_basename; + ptr = SvPV(schema, length); + rr->schema = (char *)odr_malloc(rr->stream, length + 1); + strcpy(rr->schema, ptr); + ptr = SvPV(rep_form, length); ODR_oid_buf = (int *)odr_malloc(rr->stream, (MAX_OID + 1) * sizeof(int)); if (dotted2oid(ptr, ODR_oid_buf) == -1) /* Maximum number of OID elements exceeded */ @@ -1012,6 +1022,7 @@ int bend_fetch(void *handle, bend_fetch_rr *rr) sv_free(err_code), sv_free(sur_flag); sv_free(rep_form); + sv_free(schema); PUTBACK; FREETMPS; -- 1.7.10.4