* Copyright (c) 1995-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.227 2004-01-27 12:15:11 adam Exp $
+ * $Id: client.c,v 1.228 2004-01-27 21:22:43 adam Exp $
*/
#include <stdio.h>
{
printf ("SRW diagnostic %s\n",
res->diagnostics[i].code);
-
if (res->diagnostics[i].message)
printf ("Message: %s\n", res->diagnostics[i].message);
if (res->diagnostics[i].details)
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srw.c,v 1.19 2004-01-27 12:15:12 adam Exp $
+ * $Id: srw.c,v 1.20 2004-01-27 21:22:44 adam Exp $
*/
#include <yaz/srw.h>
xmlNewNs(pptr, "http://www.loc.gov/zing/srw/diagnostics/", "diag");
for (i = 0; i < *num; i++)
{
- const char *std_diag = "info:srw/diagnostic/1/1/";
+ const char *std_diag = "info:srw/diagnostic/1/";
xmlNodePtr rptr = xmlNewChild(pptr, ns_diag, "diagnostic", 0);
add_xsd_string(rptr, "code", (*recs)[i].code);
if ((*recs)[i].message)
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.10 2004-01-27 12:15:12 adam Exp $
+ * $Id: srwutil.c,v 1.11 2004-01-27 21:22:44 adam Exp $
*/
#include <yaz/srw.h>
int code, const char *details)
{
d->code = (char *) odr_malloc(o, 50);
- sprintf(d->code, "info:srw/diagnostic/1/1/%d", code);
+ sprintf(d->code, "info:srw/diagnostic/1/%d", code);
d->message = 0;
if (details)
d->details = odr_strdup(o, details);
* Copyright (c) 2000-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.21 2004-01-27 12:15:12 adam Exp $
+ * $Id: zoom-c.c,v 1.22 2004-01-27 21:22:44 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
const char *dset,
const char *addinfo, const char *addinfo2)
{
+ char *cp;
xfree (c->addinfo);
c->addinfo = 0;
c->error = error;
- c->diagset = dset;
+ if (c->diagset && strcmp(dset, c->diagset))
+ {
+ xfree(c->diagset);
+ c->diagset = xstrdup(dset);
+ /* remove integer part from SRW diagset .. */
+ if ((cp = strrchr(c->diagset, '/')))
+ *cp = '\0';
+ }
if (addinfo && addinfo2)
{
c->addinfo = xmalloc(strlen(addinfo) + strlen(addinfo2) + 2);
c->reconnect_ok = 0;
c->state = STATE_IDLE;
c->addinfo = 0;
+ c->diagset = 0;
set_ZOOM_error(c, ZOOM_ERROR_NONE, 0);
c->buf_in = 0;
c->len_in = 0;
xfree (c->buf_in);
xfree (c->addinfo);
+ xfree (c->diagset);
odr_destroy (c->odr_in);
odr_destroy (c->odr_out);
ZOOM_options_destroy (c->options);
ZOOM_options_get(c->options, "implementationName"),
odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.21 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.22 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
ireq->implementationVersion = odr_prepend(c->odr_out,
}
if (res->num_diagnostics > 0)
{
- const char *std_diag = "info:srw/diagnostic/1/1/";
const char *code = res->diagnostics[0].code;
- const char *cp;
- const char *category = code;
- int code_int = 0;
-
- if (code && (cp = strrchr(code, '/')))
- code_int = atoi(cp+1);
- if (code && !strncmp(code, std_diag, strlen(std_diag)))
- category = "SRW";
-
- if (category)
- set_dset_error(c, code_int, category,
+ if (code)
+ {
+ int code_int = 0;
+ const char *cp;
+ if ((cp = strrchr(code, '/')))
+ code_int = atoi(cp+1);
+ set_dset_error(c, code_int, code,
res->diagnostics[0].details, 0);
+ }
}
nmem = odr_extract_mem(c->odr_in);
nmem_transfer(resultset->odr->mem, nmem);
*cp = z_HTTP_errmsg(c->error);
else if (!strcmp(c->diagset, "Bib-1"))
*cp = ZOOM_diag_str(error);
- else if (!strcmp(c->diagset, "SRW"))
+ else if (!strcmp(c->diagset, "info:srw/diagnostic/1"))
*cp = yaz_diag_srw_str(c->error);
else
*cp = "Unknown error and diagnostic set";