/* This file is part of simpleserver.
- * Copyright (C) 2000-2013 Index Data.
+ * Copyright (C) 2000-2015 Index Data.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
case Z_Operator_and: type = "Net::Z3950::RPN::And"; break;
case Z_Operator_or: type = "Net::Z3950::RPN::Or"; break;
case Z_Operator_and_not: type = "Net::Z3950::RPN::AndNot"; break;
- case Z_Operator_prox: fatal("proximity not yet supported");
+ case Z_Operator_prox: type = "Net::Z3950::RPN::Prox"; break;
default: fatal("unknown RPN operator %d", (int) c->roperator->which);
}
sv = newObject(type, (SV*) (av = newAV()));
if ((tmp = rpn2perl(c->s2)) == 0)
return 0;
av_push(av, tmp);
+ if (c->roperator->which == Z_Operator_prox) {
+ Z_ProximityOperator prox = *c->roperator->u.prox;
+ HV *hv;
+ tmp = newObject("Net::Z3950::RPN::Prox::Attributes", (SV*) (hv = newHV()));
+ setMember(hv, "exclusion", newSViv(*prox.exclusion));
+ setMember(hv, "distance", newSViv(*prox.distance));
+ setMember(hv, "ordered", newSViv(*prox.ordered));
+ setMember(hv, "relationType", newSViv(*prox.relationType));
+ if (prox.which == Z_ProximityOperator_known) {
+ setMember(hv, "known", newSViv(*prox.u.known));
+ } else {
+ setMember(hv, "zprivate", newSViv(*prox.u.zprivate));
+ }
+ av_push(av, tmp);
+ }
return sv;
}
rr->extra_response_data = odr_strdupn(rr->stream, ptr, len);
}
+ temp = hv_fetch(href, "ESTIMATED" "_HIT_" "COUNT", 19, 0);
+ if (temp)
+ {
+ rr->estimated_hit_count = SvIV(*temp);
+ }
hv_undef(href);
av_undef(aref);
HV *href;
SV **temp;
SV *basename;
- SV *record;
SV *last;
SV *err_code;
SV *err_string;
hv_store(href, "REQ_FORM", 8, newSVpv((char *)oid_dotted->buf, oid_dotted->pos), 0);
hv_store(href, "REP_FORM", 8, newSVpv((char *)oid_dotted->buf, oid_dotted->pos), 0);
hv_store(href, "BASENAME", 8, newSVpv("", 0), 0);
- hv_store(href, "RECORD", 6, newSVpv("", 0), 0);
hv_store(href, "LAST", 4, newSViv(0), 0);
hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
hv_store(href, "ERR_STR", 7, newSVpv("", 0), 0);
temp = hv_fetch(href, "BASENAME", 8, 1);
basename = newSVsv(*temp);
- temp = hv_fetch(href, "RECORD", 6, 1);
- record = newSVsv(*temp);
temp = hv_fetch(href, "LAST", 4, 1);
last = newSVsv(*temp);
temp = hv_fetch(href, "HANDLE", 6, 1);
point = newSVsv(*temp);
-
- hv_undef(href);
-
ptr = SvPV(basename, length);
rr->basename = odr_strdupn(rr->stream, ptr, length);
rr->output_format =
odr_oiddup(rr->stream, yaz_oid_recsyn_sutrs);
}
- ptr = SvPV(record, length);
- /* Treat GRS-1 records separately */
- if (!oid_oidcmp(rr->output_format, yaz_oid_recsyn_grs_1))
- {
- rr->record = (char *) read_grs1(ptr, rr->stream);
- rr->len = -1;
- }
- else
+ temp = hv_fetch(href, "RECORD", 6, 0);
+ if (temp)
{
- rr->record = odr_strdupn(rr->stream, ptr, length);
- rr->len = length;
+ SV *record = newSVsv(*temp);
+ ptr = SvPV(record, length);
+ /* Treat GRS-1 records separately */
+ if (!oid_oidcmp(rr->output_format, yaz_oid_recsyn_grs_1))
+ {
+ rr->record = (char *) read_grs1(ptr, rr->stream);
+ rr->len = -1;
+ }
+ else
+ {
+ rr->record = odr_strdupn(rr->stream, ptr, length);
+ rr->len = length;
+ }
+ sv_free(record);
}
+ hv_undef(href);
+
zhandle->handle = point;
handle = zhandle;
rr->last_in_set = SvIV(last);
wrbuf_destroy(oid_dotted);
sv_free((SV*) href);
sv_free(basename);
- sv_free(record);
sv_free(last);
sv_free(err_string);
sv_free(err_code),