/*
- * $Id: SimpleServer.xs,v 1.67 2007-08-10 16:44:00 mike Exp $
+ * $Id: SimpleServer.xs,v 1.69 2007-08-17 12:31:40 mike Exp $
* ----------------------------------------------------------------------
*
* Copyright (c) 2000-2004, Index Data.
#include "proto.h"
#include "embed.h"
#include "XSUB.h"
+#include <assert.h>
#include <yaz/backend.h>
#include <yaz/log.h>
#include <yaz/wrbuf.h>
translateOID(elem->attributeSet));
setMember(hv2, "attributeType",
newSViv(*elem->attributeType));
- assert(elem->which == Z_AttributeValue_numeric);
- setMember(hv2, "attributeValue",
- newSViv(*elem->value.numeric));
+ if (elem->which == Z_AttributeValue_numeric) {
+ setMember(hv2, "attributeValue",
+ newSViv(*elem->value.numeric));
+ } else {
+ assert(elem->which == Z_AttributeValue_complex);
+ Z_ComplexAttribute *complex = elem->value.complex;
+ Z_StringOrNumeric *son;
+ /* We ignore semantic actions and multiple values */
+ assert(complex->num_list > 0);
+ son = complex->list[0];
+ if (son->which == Z_StringOrNumeric_numeric) {
+ setMember(hv2, "attributeValue",
+ newSViv(*son->u.numeric));
+ } else { /*Z_StringOrNumeric_string*/
+ setMember(hv2, "attributeValue",
+ newSVpv(son->u.string, 0));
+ }
+ }
av_push(av, tmp);
}
setMember(hv, "attributes", attrs);
scan_list = (struct scan_entry *) odr_malloc (rr->stream, rr->num_entries * sizeof(*scan_list));
buffer = scan_list;
entries = (AV *)SvRV(entries_ref);
- for (i = 0; i < rr->num_entries; i++)
+ if (rr->errcode == 0) for (i = 0; i < rr->num_entries; i++)
{
scan_item = (HV *)SvRV(sv_2mortal(av_shift(entries)));
temp = hv_fetch(scan_item, "TERM", 4, 1);