/*
- * $Id: SimpleServer.xs,v 1.36 2006-01-30 21:29:41 adam Exp $
+ * $Id: SimpleServer.xs,v 1.37 2006-03-09 17:13:43 mike Exp $
* ----------------------------------------------------------------------
*
* Copyright (c) 2000-2004, Index Data.
SV *point;
Zfront_handle *zhandle = (Zfront_handle *)handle;
CV* handler_cv = 0;
+ SV *rpnSV;
dSP;
ENTER;
hv_store(href, "DATABASES", 9, newRV( (SV*) aref), 0);
hv_store(href, "HANDLE", 6, zhandle->handle, 0);
hv_store(href, "PID", 3, newSViv(getpid()), 0);
- hv_store(href, "RPN", 3, zquery2perl(rr->query), 0);
+ if ((rpnSV = zquery2perl(rr->query)) != 0) {
+ hv_store(href, "RPN", 3, rpnSV, 0);
+ }
query = zquery2pquery(rr->query);
if (query)
{
hv_store(href, "QUERY", 5, newSVpv((char *)query->buf, query->pos), 0);
}
+ else if (rr->query->which == Z_Query_type_104 &&
+ rr->query->u.type_104->which == Z_External_CQL) {
+ hv_store(href, "CQL", 3,
+ newSVpv(rr->query->u.type_104->u.cql, 0), 0);
+ }
else
{
rr->errcode = 108;
+ return 0;
}
PUSHMARK(sp);
zhandle->handle = point;
sv_free( (SV*) aref);
sv_free( (SV*) href);
- wrbuf_free(query, 1);
+ if (query)
+ wrbuf_free(query, 1);
PUTBACK;
FREETMPS;
LEAVE;
href = newHV();
hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0);
temp = hv_store(href, "OFFSET", 6, newSViv(rr->number), 0);
- oid_dotted = oid2dotted(rr->request_format_raw);
+ if (rr->request_format_raw != 0) {
+ oid_dotted = oid2dotted(rr->request_format_raw);
+ } else {
+ /* Probably an SRU request: assume XML is required */
+ oid_dotted = wrbuf_alloc();
+ wrbuf_puts(oid_dotted, "1.2.840.10003.5.109.10");
+ }
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);
}
else
{
- rr->errcode = 26;
+ /* This is where we end up in the case of
+ * SRU. Since record composition ("element
+ * sets") are meaningless in SRU anyway, we
+ * just skip this.
+ */
}
}