1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
7 * Demonstration of simple server
18 #include <yaz/backend.h>
20 #include <yaz/diagbib1.h>
24 static int log_level=0;
25 static int log_level_set=0;
27 int ztest_search(void *handle, bend_search_rr *rr);
28 int ztest_sort(void *handle, bend_sort_rr *rr);
29 int ztest_present(void *handle, bend_present_rr *rr);
30 int ztest_esrequest(void *handle, bend_esrequest_rr *rr);
31 int ztest_delete(void *handle, bend_delete_rr *rr);
34 \brief use term value as hit count
36 Traverse RPN tree 'in order' and use term value as hit count.
37 Only terms that looks a numeric is used.. Returns -1 if
38 no sub tree has a hit count term
40 static int get_term_hit(Z_RPNStructure *s)
45 case Z_RPNStructure_simple:
46 if (s->u.simple->which == Z_Operand_APT)
48 Z_AttributesPlusTerm *apt = s->u.simple->u.attributesPlusTerm;
49 if (apt->term->which == Z_Term_general)
51 Odr_oct *oct = apt->term->u.general;
52 if (oct->len > 0 && oct->buf[0] >= '0' && oct->buf[0] <= '9')
53 h = atoi_n((const char *) oct->buf, oct->len);
57 case Z_RPNStructure_complex:
58 h = get_term_hit(s->u.complex->s1);
60 h = get_term_hit(s->u.complex->s2);
67 \brief gets hit count for numeric terms in RPN queries
69 This is just for testing.. A real database of course uses
70 the content of a database to establish a value.. In our case, we
71 have a way to trigger a certain hit count. Good for testing of
72 client applications etc
74 static int get_hit_count(Z_Query *q)
77 if (q->which == Z_Query_type_1 || q->which == Z_Query_type_101)
78 h = get_term_hit(q->u.type_1->RPNStructure);
84 int ztest_search(void *handle, bend_search_rr *rr)
86 if (rr->num_bases != 1)
88 rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP;
91 /* Throw Database unavailable if other than Default or Slow */
92 if (!yaz_matchstr (rr->basenames[0], "Default"))
93 ; /* Default is OK in our test */
94 else if(!yaz_matchstr (rr->basenames[0], "Slow"))
97 /* wait up to 3 seconds and check if connection is still alive */
101 if (!bend_assoc_is_alive(rr->association))
103 yaz_log(YLOG_LOG, "search aborted");
109 rr->estimated_hit_count = 1;
113 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
114 rr->errstring = rr->basenames[0];
118 rr->hits = get_hit_count(rr->query);
123 /* this huge function handles extended services */
124 int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
126 /* user-defined handle - created in bend_init */
127 int *counter = (int*) handle;
129 yaz_log(log_level, "ESRequest no %d", *counter);
133 if (rr->esr->packageName)
134 yaz_log(log_level, "packagename: %s", rr->esr->packageName);
135 yaz_log(log_level, "Waitaction: %d", *rr->esr->waitAction);
138 yaz_log(log_level, "function: %d", *rr->esr->function);
140 if (!rr->esr->taskSpecificParameters)
142 yaz_log (log_level, "No task specific parameters");
144 else if (rr->esr->taskSpecificParameters->which == Z_External_itemOrder)
146 Z_ItemOrder *it = rr->esr->taskSpecificParameters->u.itemOrder;
147 yaz_log (log_level, "Received ItemOrder");
148 if (it->which == Z_IOItemOrder_esRequest)
150 Z_IORequest *ir = it->u.esRequest;
151 Z_IOOriginPartToKeep *k = ir->toKeep;
152 Z_IOOriginPartNotToKeep *n = ir->notToKeep;
153 const char *xml_in_response = 0;
157 if (k->contact->name)
158 yaz_log(log_level, "contact name %s", k->contact->name);
159 if (k->contact->phone)
160 yaz_log(log_level, "contact phone %s", k->contact->phone);
161 if (k->contact->email)
162 yaz_log(log_level, "contact email %s", k->contact->email);
166 yaz_log(log_level, "Billing info (not shown)");
169 if (n->resultSetItem)
171 yaz_log(log_level, "resultsetItem");
172 yaz_log(log_level, "setId: %s", n->resultSetItem->resultSetId);
173 yaz_log(log_level, "item: %d", *n->resultSetItem->item);
177 Z_External *r = (Z_External*) n->itemRequest;
178 ILL_ItemRequest *item_req = 0;
179 ILL_APDU *ill_apdu = 0;
180 if (r->direct_reference)
182 char oid_name_str[OID_STR_MAX];
184 const char *oid_name =
185 yaz_oid_to_string_buf(r->direct_reference,
186 &oclass, oid_name_str);
188 yaz_log(log_level, "OID %s", oid_name);
189 if (!oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml))
191 yaz_log (log_level, "ILL XML request");
192 if (r->which == Z_External_octet)
193 yaz_log (log_level, "%.*s",
194 r->u.octet_aligned->len,
195 r->u.octet_aligned->buf);
196 xml_in_response = "<dummy>x</dummy>";
198 if (!oid_oidcmp(r->direct_reference,
199 yaz_oid_general_isoill_1))
201 yaz_log (log_level, "Decode ItemRequest begin");
202 if (r->which == ODR_EXTERNAL_single)
204 odr_setbuf(rr->decode,
205 (char *) r->u.single_ASN1_type->buf,
206 r->u.single_ASN1_type->len, 0);
208 if (!ill_ItemRequest (rr->decode, &item_req, 0, 0))
211 "Couldn't decode ItemRequest %s near %ld",
212 odr_errmsg(odr_geterror(rr->decode)),
213 (long) odr_offset(rr->decode));
216 yaz_log(log_level, "Decode ItemRequest OK");
219 ill_ItemRequest (rr->print, &item_req, 0,
221 odr_reset (rr->print);
224 if (!item_req && r->which == ODR_EXTERNAL_single)
226 yaz_log (log_level, "Decode ILL APDU begin");
227 odr_setbuf(rr->decode,
228 (char*) r->u.single_ASN1_type->buf,
229 r->u.single_ASN1_type->len, 0);
231 if (!ill_APDU (rr->decode, &ill_apdu, 0, 0))
234 "Couldn't decode ILL APDU %s near %ld",
235 odr_errmsg(odr_geterror(rr->decode)),
236 (long) odr_offset(rr->decode));
237 yaz_log(log_level, "PDU dump:");
238 odr_dumpBER(yaz_log_file(),
239 (char *) r->u.single_ASN1_type->buf,
240 r->u.single_ASN1_type->len);
243 yaz_log(log_level, "Decode ILL APDU OK");
246 ill_APDU (rr->print, &ill_apdu, 0,
248 odr_reset (rr->print);
255 yaz_log (log_level, "ILL protocol version = %d",
256 *item_req->protocol_version_num);
262 Z_External *ext = (Z_External *)
263 odr_malloc (rr->stream, sizeof(*ext));
264 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
265 odr_malloc (rr->stream, sizeof(*keep));
266 Z_IOTargetPart *targetPart = (Z_IOTargetPart *)
267 odr_malloc (rr->stream, sizeof(*targetPart));
269 rr->taskPackage = (Z_TaskPackage *)
270 odr_malloc (rr->stream, sizeof(*rr->taskPackage));
271 rr->taskPackage->packageType =
272 odr_oiddup (rr->stream, rr->esr->packageType);
273 rr->taskPackage->packageName = 0;
274 rr->taskPackage->userId = 0;
275 rr->taskPackage->retentionTime = 0;
276 rr->taskPackage->permissions = 0;
277 rr->taskPackage->description = 0;
278 rr->taskPackage->targetReference = (Odr_oct *)
279 odr_malloc (rr->stream, sizeof(Odr_oct));
280 rr->taskPackage->targetReference->buf =
281 (unsigned char *) odr_strdup (rr->stream, "911");
282 rr->taskPackage->targetReference->len =
283 rr->taskPackage->targetReference->size =
284 strlen((char *) (rr->taskPackage->targetReference->buf));
285 rr->taskPackage->creationDateTime = 0;
286 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
287 rr->taskPackage->packageDiagnostics = 0;
288 rr->taskPackage->taskSpecificParameters = ext;
290 ext->direct_reference =
291 odr_oiddup (rr->stream, rr->esr->packageType);
292 ext->indirect_reference = 0;
294 ext->which = Z_External_itemOrder;
295 ext->u.itemOrder = (Z_ItemOrder *)
296 odr_malloc (rr->stream, sizeof(*ext->u.update));
297 ext->u.itemOrder->which = Z_IOItemOrder_taskPackage;
298 ext->u.itemOrder->u.taskPackage = (Z_IOTaskPackage *)
299 odr_malloc (rr->stream, sizeof(Z_IOTaskPackage));
300 ext->u.itemOrder->u.taskPackage->originPart = k;
301 ext->u.itemOrder->u.taskPackage->targetPart = targetPart;
304 targetPart->itemRequest =
305 z_ext_record_xml(rr->stream, xml_in_response,
306 strlen(xml_in_response));
308 targetPart->itemRequest = 0;
310 targetPart->statusOrErrorReport = 0;
311 targetPart->auxiliaryStatus = 0;
315 else if (rr->esr->taskSpecificParameters->which == Z_External_update)
317 Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
318 yaz_log (log_level, "Received DB Update");
319 if (up->which == Z_IUUpdate_esRequest)
321 Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
322 Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
323 Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
325 yaz_log (log_level, "action");
328 switch (*toKeep->action)
330 case Z_IUOriginPartToKeep_recordInsert:
331 yaz_log (log_level, " recordInsert");
333 case Z_IUOriginPartToKeep_recordReplace:
334 yaz_log (log_level, " recordReplace");
336 case Z_IUOriginPartToKeep_recordDelete:
337 yaz_log (log_level, " recordDelete");
339 case Z_IUOriginPartToKeep_elementUpdate:
340 yaz_log (log_level, " elementUpdate");
342 case Z_IUOriginPartToKeep_specialUpdate:
343 yaz_log (log_level, " specialUpdate");
346 yaz_log (log_level, " unknown (%d)", *toKeep->action);
349 if (toKeep->databaseName)
351 yaz_log (log_level, "database: %s", toKeep->databaseName);
352 if (!strcmp(toKeep->databaseName, "fault"))
354 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
355 rr->errstring = toKeep->databaseName;
357 if (!strcmp(toKeep->databaseName, "accept"))
362 Z_External *ext = (Z_External *)
363 odr_malloc (rr->stream, sizeof(*ext));
364 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
365 odr_malloc (rr->stream, sizeof(*keep));
366 Z_IUTargetPart *targetPart = (Z_IUTargetPart *)
367 odr_malloc (rr->stream, sizeof(*targetPart));
369 rr->taskPackage = (Z_TaskPackage *)
370 odr_malloc (rr->stream, sizeof(*rr->taskPackage));
371 rr->taskPackage->packageType =
372 odr_oiddup (rr->stream, rr->esr->packageType);
373 rr->taskPackage->packageName = 0;
374 rr->taskPackage->userId = 0;
375 rr->taskPackage->retentionTime = 0;
376 rr->taskPackage->permissions = 0;
377 rr->taskPackage->description = 0;
378 rr->taskPackage->targetReference = (Odr_oct *)
379 odr_malloc (rr->stream, sizeof(Odr_oct));
380 rr->taskPackage->targetReference->buf =
381 (unsigned char *) odr_strdup (rr->stream, "123");
382 rr->taskPackage->targetReference->len =
383 rr->taskPackage->targetReference->size =
384 strlen((char *) (rr->taskPackage->targetReference->buf));
385 rr->taskPackage->creationDateTime = 0;
386 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
387 rr->taskPackage->packageDiagnostics = 0;
388 rr->taskPackage->taskSpecificParameters = ext;
390 ext->direct_reference =
391 odr_oiddup (rr->stream, rr->esr->packageType);
392 ext->indirect_reference = 0;
394 ext->which = Z_External_update;
395 ext->u.update = (Z_IUUpdate *)
396 odr_malloc (rr->stream, sizeof(*ext->u.update));
397 ext->u.update->which = Z_IUUpdate_taskPackage;
398 ext->u.update->u.taskPackage = (Z_IUUpdateTaskPackage *)
399 odr_malloc (rr->stream, sizeof(Z_IUUpdateTaskPackage));
400 ext->u.update->u.taskPackage->originPart = keep;
401 ext->u.update->u.taskPackage->targetPart = targetPart;
403 keep->action = (int *) odr_malloc (rr->stream, sizeof(int));
404 *keep->action = *toKeep->action;
406 odr_strdup (rr->stream, toKeep->databaseName);
408 keep->elementSetName = 0;
409 keep->actionQualifier = 0;
411 targetPart->updateStatus = odr_intdup (rr->stream, 1);
412 targetPart->num_globalDiagnostics = 0;
413 targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval();
414 targetPart->num_taskPackageRecords = 1;
415 targetPart->taskPackageRecords =
416 (Z_IUTaskPackageRecordStructure **)
417 odr_malloc (rr->stream,
418 sizeof(Z_IUTaskPackageRecordStructure *));
419 targetPart->taskPackageRecords[0] =
420 (Z_IUTaskPackageRecordStructure *)
421 odr_malloc (rr->stream,
422 sizeof(Z_IUTaskPackageRecordStructure));
424 targetPart->taskPackageRecords[0]->which =
425 Z_IUTaskPackageRecordStructure_record;
426 targetPart->taskPackageRecords[0]->u.record =
427 z_ext_record_sutrs(rr->stream, "test", 4);
428 targetPart->taskPackageRecords[0]->correlationInfo = 0;
429 targetPart->taskPackageRecords[0]->recordStatus =
430 odr_intdup (rr->stream,
431 Z_IUTaskPackageRecordStructure_success);
432 targetPart->taskPackageRecords[0]->num_supplementalDiagnostics
435 targetPart->taskPackageRecords[0]->supplementalDiagnostics = 0;
440 for (i = 0; i < notToKeep->num; i++)
442 Z_External *rec = notToKeep->elements[i]->record;
444 if (rec->direct_reference)
446 char oid_name_str[OID_STR_MAX];
448 = oid_name = yaz_oid_to_string_buf(
449 rec->direct_reference, 0,
452 yaz_log (log_level, "record %d type %s", i,
457 case Z_External_sutrs:
458 if (rec->u.octet_aligned->len > 170)
459 yaz_log (log_level, "%d bytes:\n%.168s ...",
463 yaz_log (log_level, "%d bytes:\n%s",
467 case Z_External_octet :
468 if (rec->u.octet_aligned->len > 170)
469 yaz_log (log_level, "%d bytes:\n%.168s ...",
470 rec->u.octet_aligned->len,
471 rec->u.octet_aligned->buf);
473 yaz_log (log_level, "%d bytes\n%s",
474 rec->u.octet_aligned->len,
475 rec->u.octet_aligned->buf);
484 /* result set delete */
485 int ztest_delete (void *handle, bend_delete_rr *rr)
487 if (rr->num_setnames == 1 && !strcmp (rr->setnames[0], "1"))
488 rr->delete_status = Z_DeleteStatus_success;
490 rr->delete_status = Z_DeleteStatus_resultSetDidNotExist;
494 /* Our sort handler really doesn't sort... */
495 int ztest_sort (void *handle, bend_sort_rr *rr)
498 rr->sort_status = Z_SortResponse_success;
503 /* present request handler */
504 int ztest_present (void *handle, bend_present_rr *rr)
509 /* retrieval of a single record (present, and piggy back search) */
510 int ztest_fetch(void *handle, bend_fetch_rr *r)
513 const Odr_oid *oid = r->request_format;
516 r->basename = "Default";
517 r->output_format = r->request_format;
519 if (!oid || yaz_oid_is_iso2709(oid))
521 cp = dummy_marc_record(r->number, r->stream);
524 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
530 r->output_format = odr_oiddup(r->stream, yaz_oid_recsyn_usmarc);
533 else if (!oid_oidcmp(oid, yaz_oid_recsyn_opac))
537 cp = dummy_marc_record(r->number, r->stream);
540 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
543 rec = odr_malloc(r->stream, sizeof(*rec));
544 rec->bibliographicRecord =
545 z_ext_record_usmarc(r->stream, cp, strlen(cp));
546 rec->num_holdingsData = 1;
547 rec->holdingsData = odr_malloc(r->stream, sizeof(*rec->holdingsData));
548 for (i = 0; i < rec->num_holdingsData; i++)
550 Z_HoldingsRecord *hr = odr_malloc(r->stream, sizeof(*hr));
551 Z_HoldingsAndCircData *hc = odr_malloc(r->stream, sizeof(*hc));
553 rec->holdingsData[i] = hr;
554 hr->which = Z_HoldingsRecord_holdingsAndCirc;
555 hr->u.holdingsAndCirc = hc;
557 hc->typeOfRecord = odr_strdup(r->stream, "x");
558 hc->typeOfRecord[0] = cp[5]; /* LDR 6 */
560 hc->encodingLevel = odr_strdup(r->stream, "x");
561 hc->encodingLevel[0] = cp[16]; /* LDR 17 */
563 hc->format = 0; /* OPT */
564 hc->receiptAcqStatus = 0; /* OPT */
565 hc->generalRetention = 0; /* OPT */
566 hc->completeness = 0; /* OPT */
567 hc->dateOfReport = 0; /* OPT */
568 hc->nucCode = 0; /* OPT */
569 hc->localLocation = 0; /* OPT */
570 hc->shelvingLocation = 0; /* OPT */
571 hc->callNumber = 0; /* OPT */
572 hc->shelvingData = 0; /* OPT */
573 hc->copyNumber = 0; /* OPT */
574 hc->publicNote = 0; /* OPT */
575 hc->reproductionNote = 0; /* OPT */
576 hc->termsUseRepro = 0; /* OPT */
577 hc->enumAndChron = 0; /* OPT */
582 hc->num_circulationData = 0;
583 hc->circulationData = 0;
587 r->record = (char*) rec;
589 else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
591 /* this section returns a small record */
594 sprintf(buf, "This is dummy SUTRS record number %d\n", r->number);
596 r->len = strlen(buf);
597 r->record = (char *) odr_malloc (r->stream, r->len+1);
598 strcpy(r->record, buf);
600 else if (!oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
603 r->record = (char*) dummy_grs_record(r->number, r->stream);
606 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
610 else if (!oid_oidcmp(oid, yaz_oid_recsyn_postscript))
616 sprintf (fname, "part.%d.ps", r->number);
617 f = fopen(fname, "rb");
620 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
623 fseek (f, 0L, SEEK_END);
625 if (size <= 0 || size >= 5000000)
627 r->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
630 fseek (f, 0L, SEEK_SET);
631 r->record = (char*) odr_malloc (r->stream, size);
633 fread (r->record, size, 1, f);
636 else if (!oid_oidcmp(oid, yaz_oid_recsyn_xml))
638 if ((cp = dummy_xml_record (r->number, r->stream)))
645 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
646 r->surrogate_flag = 1;
652 char buf[OID_STR_MAX];
653 r->errcode = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
654 r->errstring = odr_strdup(r->stream, oid_oid_to_dotstring(oid, buf));
662 * silly dummy-scan what reads words from a file.
664 int ztest_scan(void *handle, bend_scan_rr *q)
667 static struct scan_entry list[200];
668 static char entries[200][80];
672 int term_position_req = q->term_position;
673 int num_entries_req = q->num_entries;
675 /* Throw Database unavailable if other than Default or Slow */
676 if (!yaz_matchstr (q->basenames[0], "Default"))
677 ; /* Default is OK in our test */
678 else if(!yaz_matchstr (q->basenames[0], "Slow"))
687 q->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
688 q->errstring = q->basenames[0];
695 q->status = BEND_SCAN_SUCCESS;
696 if (!f && !(f = fopen("dummy-words", "r")))
698 perror("dummy-words");
701 if (q->num_entries > 200)
703 q->errcode = YAZ_BIB1_RESOURCES_EXHAUSTED_NO_RESULTS_AVAILABLE;
709 if (q->term->term->which != Z_Term_general)
711 q->errcode = YAZ_BIB1_TERM_TYPE_UNSUPP;
714 if (*q->step_size != 0)
716 q->errcode = YAZ_BIB1_ONLY_ZERO_STEP_SIZE_SUPPORTED_FOR_SCAN;
719 len = q->term->term->u.general->len;
720 if (len >= sizeof(term))
721 len = sizeof(term)-1;
722 memcpy(term, q->term->term->u.general->buf, len);
725 else if (q->scanClause)
727 strncpy(term, q->scanClause, sizeof(term)-1);
728 term[sizeof(term)-1] = '\0';
733 for (p = term; *p; p++)
734 if (islower(*(unsigned char *) p))
737 fseek(f, 0, SEEK_SET);
740 for (i = 0, pos = 0; fscanf(f, " %79[^:]:%d", entries[pos], &hits[pos]) == 2;
741 i++, pos < 199 ? pos++ : (pos = 0))
743 if (!q->num_entries && strcmp(entries[pos], term) >= 0) /* s-point fnd */
745 if ((q->term_position = term_position_req) > i + 1)
747 q->term_position = i + 1;
748 q->status = BEND_SCAN_PARTIAL;
750 for (; q->num_entries < q->term_position; q->num_entries++)
754 po = pos - q->term_position + q->num_entries+1; /* find pos */
758 if (!strcmp (term, "SD") && q->num_entries == 2)
760 list[q->num_entries].term = entries[pos];
761 list[q->num_entries].occurrences = -1;
762 list[q->num_entries].errcode =
763 YAZ_BIB1_SCAN_UNSUPP_VALUE_OF_POSITION_IN_RESPONSE;
764 list[q->num_entries].errstring = "SD for Scan Term";
768 list[q->num_entries].term = entries[po];
769 list[q->num_entries].occurrences = hits[po];
773 else if (q->num_entries)
775 list[q->num_entries].term = entries[pos];
776 list[q->num_entries].occurrences = hits[pos];
779 if (q->num_entries >= num_entries_req)
783 q->status = BEND_SCAN_PARTIAL;
787 int ztest_explain(void *handle, bend_explain_rr *rr)
789 if (rr->database && !strcmp(rr->database, "Default"))
791 rr->explain_buf = "<explain>\n"
793 "\t\t<host>localhost</host>\n"
794 "\t\t<port>210</port>\n"
801 int ztest_update(void *handle, bend_update_rr *rr)
803 rr->operation_status = "success";
807 bend_initresult *bend_init(bend_initrequest *q)
809 bend_initresult *r = (bend_initresult *)
810 odr_malloc (q->stream, sizeof(*r));
811 int *counter = (int *) xmalloc (sizeof(int));
815 log_level=yaz_log_module_level("ztest");
822 r->handle = counter; /* user handle, in this case a simple int */
823 q->bend_sort = ztest_sort; /* register sort handler */
824 q->bend_search = ztest_search; /* register search handler */
825 q->bend_present = ztest_present; /* register present handle */
826 q->bend_esrequest = ztest_esrequest;
827 q->bend_delete = ztest_delete;
828 q->bend_fetch = ztest_fetch;
829 q->bend_scan = ztest_scan;
831 q->bend_explain = ztest_explain;
833 q->bend_srw_scan = ztest_scan;
834 q->bend_srw_update = ztest_update;
836 q->query_charset = "ISO-8859-1";
837 q->records_in_same_charset = 0;
842 void bend_close(void *handle)
844 xfree (handle); /* release our user-defined handle */
848 int main(int argc, char **argv)
850 return statserv_main(argc, argv, bend_init, bend_close);
855 * indent-tabs-mode: nil
857 * vim: shiftwidth=4 tabstop=8 expandtab