Possible compatibility problems with earlier versions marked with '*'.
+* SRW/SRU 1.1 updates. Diagnostic code now a URI.
+
Added option -p <file> to make Generic Frontend Server to write PID file.
Added option -D to put Generic Frontend Server in background on its own.
* Copyright (c) 1995-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.226 2004-01-15 10:16:26 adam Exp $
+ * $Id: client.c,v 1.227 2004-01-27 12:15:11 adam Exp $
*/
#include <stdio.h>
for (i = 0; i<res->num_diagnostics; i++)
{
- printf ("SRW diagnostic %d %s\n",
- *res->diagnostics[i].code,
- yaz_diag_srw_str(*res->diagnostics[i].code));
+ 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)
printf ("Details: %s\n", res->diagnostics[i].details);
}
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srw.h,v 1.14 2004-01-09 18:10:31 adam Exp $
+ * $Id: srw.h,v 1.15 2004-01-27 12:15:11 adam Exp $
*/
#ifndef YAZ_SRW_H
} Z_SRW_record;
typedef struct {
- int *code;
+ char *code;
char *details;
+ char *message;
} Z_SRW_diagnostic;
typedef struct {
char **charset,
Z_SRW_diagnostic **, int *num_diagnostic);
-void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
- int *num, int code, const char *addinfo);
+YAZ_EXPORT void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
+ int *num, int code,
+ const char *addinfo);
+YAZ_EXPORT void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d,
+ int code, const char *details);
YAZ_END_CDECL
#endif
* Copyright (c) 1995-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.18 2004-01-23 18:16:07 adam Exp $
+ * $Id: seshigh.c,v 1.19 2004-01-27 12:15:12 adam Exp $
*/
/*
srw_res->num_diagnostics = 1;
srw_res->diagnostics = (Z_SRW_diagnostic *)
odr_malloc(assoc->encode, sizeof(*srw_res->diagnostics));
- srw_res->diagnostics[0].code =
- odr_intdup(assoc->encode, srw_error);
- srw_res->diagnostics[0].details = 0;
+ yaz_mk_std_diagnostic(assoc->encode,
+ srw_res->diagnostics, srw_error, 0);
return;
}
srw_res->num_diagnostics = 1;
srw_res->diagnostics = (Z_SRW_diagnostic *)
odr_malloc(assoc->encode, sizeof(*srw_res->diagnostics));
- srw_res->diagnostics[0].code =
- odr_intdup(assoc->encode,
- yaz_diag_bib1_to_srw (rr.errcode));
- srw_res->diagnostics[0].details = rr.errstring;
+ 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);
-
}
else
{
srw_res->diagnostics = (Z_SRW_diagnostic *)
odr_malloc(assoc->encode,
sizeof(*srw_res->diagnostics));
- srw_res->diagnostics[0].code =
- odr_intdup(assoc->encode,
- yaz_diag_bib1_to_srw (errcode));
- srw_res->diagnostics[0].details = rr.errstring;
+
+ yaz_mk_std_diagnostic(assoc->encode,
+ srw_res->diagnostics,
+ yaz_diag_bib1_to_srw (errcode),
+ rr.errstring);
break;
}
if (srw_res->records[j].recordData_buf)
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.18 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.19 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srw.c,v 1.18 2004-01-15 23:33:29 adam Exp $
+ * $Id: srw.c,v 1.19 2004-01-27 12:15:12 adam Exp $
*/
#include <yaz/srw.h>
{
(*recs)[i].code = 0;
(*recs)[i].details = 0;
+ (*recs)[i].message = 0;
}
for (i = 0, ptr = pptr->children; ptr; ptr = ptr->next)
{
xmlNodePtr rptr;
(*recs)[i].code = 0;
(*recs)[i].details = 0;
+ (*recs)[i].message = 0;
for (rptr = ptr->children; rptr; rptr = rptr->next)
{
- if (match_xsd_integer(rptr, "code", o,
- &(*recs)[i].code))
+ if (match_xsd_string(rptr, "code", o,
+ &(*recs)[i].code))
;
else if (match_xsd_string(rptr, "details", o,
&(*recs)[i].details))
;
+ else if (match_xsd_string(rptr, "message", o,
+ &(*recs)[i].message))
+ ;
}
i++;
}
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/";
xmlNodePtr rptr = xmlNewChild(pptr, ns_diag, "diagnostic", 0);
- add_xsd_integer(rptr, "code", (*recs)[i].code);
- if ((*recs)[i].code)
+ add_xsd_string(rptr, "code", (*recs)[i].code);
+ 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)))
{
- const char *message = yaz_diag_srw_str(*(*recs)[i].code);
+ int no = atoi((*recs)[i].code + strlen(std_diag));
+ const char *message = yaz_diag_srw_str(no);
if (message)
add_xsd_string(rptr, "message", message);
}
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.9 2004-01-09 19:54:05 adam Exp $
+ * $Id: srwutil.c,v 1.10 2004-01-27 12:15:12 adam Exp $
*/
#include <yaz/srw.h>
*intp = odr_intdup(o, atoi(v));
}
+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/1/%d", code);
+ d->message = 0;
+ if (details)
+ d->details = odr_strdup(o, details);
+ else
+ d->details = 0;
+}
+
void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
int *num, int code, const char *addinfo)
{
if (*num)
memcpy (d_new, *d, *num *sizeof(**d));
*d = d_new;
- (*d + *num)->code = odr_intdup(o, code);
- if (addinfo)
- (*d + *num)->details = odr_strdup(o, addinfo);
- else
- (*d + *num)->details = 0;
+
+ yaz_mk_std_diagnostic(o, *d + *num, code, addinfo);
(*num)++;
}
else if (!strcmp(n, "startRecord"))
startRecord = v;
else
- yaz_add_srw_diagnostic(decode, diag, num_diag, 9, n);
+ yaz_add_srw_diagnostic(decode, diag, num_diag, 8, n);
}
}
if (!version)
{5, "Unsupported version"},
{6, "Unsupported parameter value"},
{7, "Mandatory parameter not supplied"},
-{8, "Unknown database"},
-{9, "Unknown parameter type"},
+{8, "Unsupported parameter"},
/* Diagnostics Relating to CQL */
{10, "Query syntax error"},
{11, "Unsupported query type"},
108, 27,
108, 45,
- 109, 9,
+ 109, 2,
110, 37,
111, 1,
112, 58,
* Copyright (c) 2000-2004, Index Data
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.20 2004-01-22 11:20:54 adam Exp $
+ * $Id: zoom-c.c,v 1.21 2004-01-27 12:15:12 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
ZOOM_options_get(c->options, "implementationName"),
odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName));
- version = odr_strdup(c->odr_out, "$Revision: 1.20 $");
+ version = odr_strdup(c->odr_out, "$Revision: 1.21 $");
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)
{
- set_dset_error(c, *res->diagnostics[0].code, "SRW",
- res->diagnostics[0].details, 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,
+ res->diagnostics[0].details, 0);
}
nmem = odr_extract_mem(c->odr_in);
nmem_transfer(resultset->odr->mem, nmem);
/*
- * Copyright (c) 1995-2003, Index Data.
+ * Copyright (c) 1995-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: ztest.c,v 1.60 2004-01-15 10:04:39 adam Exp $
+ * $Id: ztest.c,v 1.61 2004-01-27 12:15:12 adam Exp $
*/
/*
rr->errcode = 23;
return 0;
}
- /* if database is stop, stop this process.. For debugging only.
+#if NMEM_DEBUG
+ /* if database is stop, stop this process.. For debugging only. */
if (!yaz_matchstr (rr->basenames[0], "stop"))
{
nmem_print_list_l(LOG_LOG);
exit(0);
}
+#endif
/* Throw Database unavailable if other than Default */
if (yaz_matchstr (rr->basenames[0], "Default"))
{