/*
- * Copyright (c) 1995-2003, Index Data.
+ * Copyright (c) 1995-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: ztest.c,v 1.54 2003-01-06 08:20:29 adam Exp $
+ * $Id: ztest.c,v 1.62 2004-01-27 21:22:44 adam Exp $
*/
/*
#include <stdlib.h>
#include <ctype.h>
+#include <yaz/yaz-util.h>
#include <yaz/backend.h>
-#include <yaz/log.h>
-
#include <yaz/ill.h>
Z_GenericRecord *dummy_grs_record (int num, ODR o);
rr->errcode = 23;
return 0;
}
- if (strcmp (rr->basenames[0], "Default"))
+#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"))
{
rr->errcode = 109;
rr->errstring = rr->basenames[0];
}
}
}
+ else if (rr->esr->taskSpecificParameters->which == Z_External_update0)
+ {
+ yaz_log(LOG_LOG, "Received DB Update (version 0)");
+ }
else
{
yaz_log (LOG_WARN, "Unknown Extended Service(%d)",
int ztest_fetch(void *handle, bend_fetch_rr *r)
{
char *cp;
- r->errstring = 0;
+
r->last_in_set = 0;
r->basename = "Default";
r->output_format = r->request_format;
return 0;
}
+static int ztest_explain(void *handle, bend_explain_rr *rr)
+{
+ if (rr->database && !strcmp(rr->database, "Default"))
+ {
+ rr->explain_buf = "<explain>\n"
+ "\t<serverInfo>\n"
+ "\t\t<host>localhost</host>\n"
+ "\t\t<port>210</port>\n"
+ "\t</serverInfo>\n"
+ "</explain>\n";
+ }
+ return 0;
+}
+
bend_initresult *bend_init(bend_initrequest *q)
{
- bend_initresult *r = (bend_initresult *) odr_malloc (q->stream, sizeof(*r));
+ bend_initresult *r = (bend_initresult *)
+ odr_malloc (q->stream, sizeof(*r));
int *counter = (int *) xmalloc (sizeof(int));
*counter = 0;
q->bend_delete = ztest_delete;
q->bend_fetch = ztest_fetch;
q->bend_scan = ztest_scan;
+ q->bend_explain = ztest_explain;
return r;
}