From: Adam Dickmeiss Date: Sat, 14 Feb 2004 15:58:42 +0000 (+0000) Subject: SRW/SRU update: use uri instead of code for diagnostic X-Git-Tag: YAZ.2.0.11~3 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=97554b23cfc19394bb77f7f3c4bf0c8abf89297b SRW/SRU update: use uri instead of code for diagnostic --- diff --git a/CHANGELOG b/CHANGELOG index 664fc6f..c5ac7b2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Possible compatibility problems with earlier versions marked with '*'. +* SRW/SRU 1.1 updates: updated diagnostic in srw.h to use uri instead +of code. + Added init command for yaz-client which sends "extra" init request. Fixed two bugs in OID codec - ber_oidc. Throw error when encoding/decoding diff --git a/client/client.c b/client/client.c index f3b896c..2cf6792 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.229 2004-02-14 15:44:15 adam Exp $ + * $Id: client.c,v 1.230 2004-02-14 15:58:42 adam Exp $ */ #include @@ -1208,6 +1208,9 @@ static int send_SRW_searchRequest(const char *arg) sr = yaz_srw_get(out, Z_SRW_searchRetrieve_request); sr->u.request->query_type = Z_SRW_query_type_cql; sr->u.request->query.cql = odr_strdup(out, arg); + + sr->u.request->maximumRecords = odr_intdup(out, 0); + if (record_schema) sr->u.request->recordSchema = record_schema; return send_srw(sr); @@ -3312,8 +3315,11 @@ static void handle_srw_response(Z_SRW_searchRetrieveResponse *res) for (i = 0; inum_diagnostics; i++) { - printf ("SRW diagnostic %s\n", - res->diagnostics[i].code); + if (res->diagnostics[i].uri) + printf ("SRW diagnostic %s\n", + res->diagnostics[i].uri); + else + printf ("SRW diagnostic missing or could not be decoded\n"); if (res->diagnostics[i].message) printf ("Message: %s\n", res->diagnostics[i].message); if (res->diagnostics[i].details) diff --git a/include/yaz/srw.h b/include/yaz/srw.h index 42f93e2..8c93983 100644 --- a/include/yaz/srw.h +++ b/include/yaz/srw.h @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srw.h,v 1.15 2004-01-27 12:15:11 adam Exp $ + * $Id: srw.h,v 1.16 2004-02-14 15:58:42 adam Exp $ */ #ifndef YAZ_SRW_H @@ -24,7 +24,7 @@ typedef struct { } Z_SRW_record; typedef struct { - char *code; + char *uri; char *details; char *message; } Z_SRW_diagnostic; diff --git a/src/seshigh.c b/src/seshigh.c index 34fe0b0..9906fa4 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.19 2004-01-27 12:15:12 adam Exp $ + * $Id: seshigh.c,v 1.20 2004-02-14 15:58:42 adam Exp $ */ /* @@ -663,8 +663,8 @@ static void srw_bend_search(association *assoc, request *req, yaz_mk_std_diagnostic(assoc->encode, srw_res->diagnostics, yaz_diag_bib1_to_srw (rr.errcode), rr.errstring); - yaz_log(LOG_DEBUG, "srw_bend_search returned SRW error %d", - *srw_res->diagnostics[0].code); + yaz_log(LOG_DEBUG, "srw_bend_search returned SRW error %s", + srw_res->diagnostics[0].uri); } else { @@ -1317,7 +1317,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.19 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.20 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, diff --git a/src/srw.c b/src/srw.c index 9fdadce..edb5741 100644 --- a/src/srw.c +++ b/src/srw.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srw.c,v 1.20 2004-01-27 21:22:44 adam Exp $ + * $Id: srw.c,v 1.21 2004-02-14 15:58:42 adam Exp $ */ #include @@ -285,7 +285,7 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, *recs = odr_malloc(o, *num * sizeof(**recs)); for (i = 0; i < *num; i++) { - (*recs)[i].code = 0; + (*recs)[i].uri = 0; (*recs)[i].details = 0; (*recs)[i].message = 0; } @@ -295,13 +295,13 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, !strcmp(ptr->name, "diagnostic")) { xmlNodePtr rptr; - (*recs)[i].code = 0; + (*recs)[i].uri = 0; (*recs)[i].details = 0; (*recs)[i].message = 0; for (rptr = ptr->children; rptr; rptr = rptr->next) { - if (match_xsd_string(rptr, "code", o, - &(*recs)[i].code)) + if (match_xsd_string(rptr, "uri", o, + &(*recs)[i].uri)) ; else if (match_xsd_string(rptr, "details", o, &(*recs)[i].details)) @@ -323,13 +323,13 @@ static int yaz_srw_diagnostics(ODR o, xmlNodePtr pptr, Z_SRW_diagnostic **recs, { const char *std_diag = "info:srw/diagnostic/1/"; xmlNodePtr rptr = xmlNewChild(pptr, ns_diag, "diagnostic", 0); - add_xsd_string(rptr, "code", (*recs)[i].code); + add_xsd_string(rptr, "uri", (*recs)[i].uri); if ((*recs)[i].message) add_xsd_string(rptr, "message", (*recs)[i].message); - else if ((*recs)[i].code && - !strncmp((*recs)[i].code, std_diag, strlen(std_diag))) + else if ((*recs)[i].uri && + !strncmp((*recs)[i].uri, std_diag, strlen(std_diag))) { - int no = atoi((*recs)[i].code + strlen(std_diag)); + int no = atoi((*recs)[i].uri + strlen(std_diag)); const char *message = yaz_diag_srw_str(no); if (message) add_xsd_string(rptr, "message", message); diff --git a/src/srwutil.c b/src/srwutil.c index a7bc839..06355d1 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srwutil.c,v 1.11 2004-01-27 21:22:44 adam Exp $ + * $Id: srwutil.c,v 1.12 2004-02-14 15:58:42 adam Exp $ */ #include @@ -134,8 +134,8 @@ void yaz_uri_val_int(const char *path, const char *name, ODR o, int **intp) void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, int code, const char *details) { - d->code = (char *) odr_malloc(o, 50); - sprintf(d->code, "info:srw/diagnostic/1/%d", code); + d->uri = (char *) odr_malloc(o, 50); + sprintf(d->uri, "info:srw/diagnostic/1/%d", code); d->message = 0; if (details) d->details = odr_strdup(o, details); diff --git a/src/zoom-c.c b/src/zoom-c.c index 401f658..6078c93 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.23 2004-02-11 13:37:17 adam Exp $ + * $Id: zoom-c.c,v 1.24 2004-02-14 15:58:42 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -935,7 +935,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c) ZOOM_options_get(c->options, "implementationName"), odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.23 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.24 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = odr_prepend(c->odr_out, @@ -2967,14 +2967,14 @@ static void handle_srw_response(ZOOM_connection c, } if (res->num_diagnostics > 0) { - const char *code = res->diagnostics[0].code; - if (code) + const char *uri = res->diagnostics[0].uri; + if (uri) { - int code_int = 0; + int code = 0; const char *cp; - if ((cp = strrchr(code, '/'))) - code_int = atoi(cp+1); - set_dset_error(c, code_int, code, + if ((cp = strrchr(uri, '/'))) + code = atoi(cp+1); + set_dset_error(c, code, uri, res->diagnostics[0].details, 0); } }