/*
* Public header for ZOOM C.
- * $Id: zoom.h,v 1.19 2003-11-19 19:07:26 adam Exp $
+ * $Id: zoom.h,v 1.20 2004-02-11 13:37:16 adam Exp $
*/
#include <yaz/yconfig.h>
#define ZOOM_ERROR_TIMEOUT 10007
#define ZOOM_ERROR_UNSUPPORTED_PROTOCOL 10008
#define ZOOM_ERROR_UNSUPPORTED_QUERY 10009
+#define ZOOM_ERROR_INVALID_QUERY 10010
ZOOM_API(int)
ZOOM_connection_last_event(ZOOM_connection cs);
* Copyright (c) 2000-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.22 2004-01-27 21:22:44 adam Exp $
+ * $Id: zoom-c.c,v 1.23 2004-02-11 13:37:17 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
xfree (c->addinfo);
c->addinfo = 0;
c->error = error;
- if (c->diagset && strcmp(dset, c->diagset))
+ if (!c->diagset || strcmp(dset, c->diagset))
{
xfree(c->diagset);
c->diagset = xstrdup(dset);
s->z_query->which = Z_Query_type_1;
s->z_query->u.type_1 = p_query_rpn(s->odr, PROTO_Z3950, str);
if (!s->z_query->u.type_1)
+ {
+ s->z_query = 0;
return -1;
+ }
return 0;
}
ZOOM_options_get(c->options, "implementationName"),
odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.22 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.23 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion = odr_prepend(c->odr_out,
/* prepare query for the search request */
search_req->query = r->query->z_query;
+ if (!search_req->query)
+ {
+ set_ZOOM_error(c, ZOOM_ERROR_INVALID_QUERY, 0);
+ return zoom_complete;
+ }
search_req->databaseNames =
set_DatabaseNames (c, r->options, &search_req->num_databaseNames);
return "Unsupported protocol";
case ZOOM_ERROR_UNSUPPORTED_QUERY:
return "Unsupported query type";
+ case ZOOM_ERROR_INVALID_QUERY:
+ return "Invalid query";
default:
return diagbib1_str (error);
}