1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2010 Index Data
3 * See the file LICENSE for details.
7 * \brief yaz-ztest Generic Frontend 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);
33 /** \brief use term value as hit count
34 \param s RPN structure
35 \return >= 0: search term number or -1: not found
37 Traverse RPN tree 'in order' and use term value as hit count.
38 Only terms that looks a numeric is used.. Returns -1 if
39 no sub tree has a hit count term
41 static Odr_int get_term_hit(Z_RPNStructure *s)
46 case Z_RPNStructure_simple:
47 if (s->u.simple->which == Z_Operand_APT)
49 Z_AttributesPlusTerm *apt = s->u.simple->u.attributesPlusTerm;
50 if (apt->term->which == Z_Term_general)
52 Odr_oct *oct = apt->term->u.general;
53 if (oct->len > 0 && oct->buf[0] >= '0' && oct->buf[0] <= '9')
55 WRBUF hits_str = wrbuf_alloc();
56 wrbuf_write(hits_str, (const char *) oct->buf, oct->len);
57 h = odr_atoi(wrbuf_cstr(hits_str));
58 wrbuf_destroy(hits_str);
63 case Z_RPNStructure_complex:
64 h = get_term_hit(s->u.complex->s1);
66 h = get_term_hit(s->u.complex->s2);
72 /** \brief gets hit count for numeric terms in RPN queries
74 \return number of hits (random or number for term)
76 This is just for testing.. A real database of course uses
77 the content of a database to establish a value.. In our case, we
78 have a way to trigger a certain hit count. Good for testing of
79 client applications etc
81 static Odr_int get_hit_count(Z_Query *q)
84 if (q->which == Z_Query_type_1 || q->which == Z_Query_type_101)
85 h = get_term_hit(q->u.type_1->RPNStructure);
91 /** \brief checks if it's a dummy Slow database
92 \param basename database name to check
93 \param association backend association (or NULL if not available)
94 \retval 1 is slow database
95 \retval 0 is not a slow database
97 The Slow database is for testing.. It allows us to simulate
100 static int check_slow(const char *basename, bend_association association)
102 if (strncmp(basename, "Slow", 4) == 0)
107 sscanf(basename+4, "%d", &w);
108 /* wait up to 3 seconds and check if connection is still alive */
109 for (i = 0; i < w; i++)
111 if (association && !bend_assoc_is_alive(association))
113 yaz_log(YLOG_LOG, "search aborted");
124 int ztest_search(void *handle, bend_search_rr *rr)
126 if (rr->num_bases != 1)
128 rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP;
131 /* Allow Default, db.* and Slow */
132 if (!yaz_matchstr(rr->basenames[0], "Default"))
133 ; /* Default is OK in our test */
134 else if (!strncmp(rr->basenames[0], "db", 2))
135 ; /* db.* is OK in our test */
136 else if (check_slow(rr->basenames[0], rr->association))
138 rr->estimated_hit_count = 1;
142 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
143 rr->errstring = rr->basenames[0];
150 WRBUF response_xml = wrbuf_alloc();
151 wrbuf_puts(response_xml, "<extra>");
152 for (a = rr->extra_args; a; a = a->next)
154 wrbuf_puts(response_xml, "<extra name=\"");
155 wrbuf_xmlputs(response_xml, a->name);
156 wrbuf_puts(response_xml, "\"");
159 wrbuf_puts(response_xml, " value=\"");
160 wrbuf_xmlputs(response_xml, a->value);
161 wrbuf_puts(response_xml, "\"");
163 wrbuf_puts(response_xml, "/>");
165 wrbuf_puts(response_xml, "</extra>");
166 rr->extra_response_data =
167 odr_strdup(rr->stream, wrbuf_cstr(response_xml));
168 wrbuf_destroy(response_xml);
170 rr->hits = get_hit_count(rr->query);
175 /* this huge function handles extended services */
176 int ztest_esrequest(void *handle, bend_esrequest_rr *rr)
178 /* user-defined handle - created in bend_init */
179 int *counter = (int*) handle;
181 yaz_log(log_level, "ESRequest no %d", *counter);
185 if (rr->esr->packageName)
186 yaz_log(log_level, "packagename: %s", rr->esr->packageName);
187 yaz_log(log_level, "Waitaction: " ODR_INT_PRINTF, *rr->esr->waitAction);
190 yaz_log(log_level, "function: " ODR_INT_PRINTF, *rr->esr->function);
192 if (!rr->esr->taskSpecificParameters)
194 yaz_log(log_level, "No task specific parameters");
196 else if (rr->esr->taskSpecificParameters->which == Z_External_itemOrder)
198 Z_ItemOrder *it = rr->esr->taskSpecificParameters->u.itemOrder;
199 yaz_log(log_level, "Received ItemOrder");
200 if (it->which == Z_IOItemOrder_esRequest)
202 Z_IORequest *ir = it->u.esRequest;
203 Z_IOOriginPartToKeep *k = ir->toKeep;
204 Z_IOOriginPartNotToKeep *n = ir->notToKeep;
205 const char *xml_in_response = 0;
209 if (k->contact->name)
210 yaz_log(log_level, "contact name %s", k->contact->name);
211 if (k->contact->phone)
212 yaz_log(log_level, "contact phone %s", k->contact->phone);
213 if (k->contact->email)
214 yaz_log(log_level, "contact email %s", k->contact->email);
218 yaz_log(log_level, "Billing info (not shown)");
221 if (n->resultSetItem)
223 yaz_log(log_level, "resultsetItem");
224 yaz_log(log_level, "setId: %s", n->resultSetItem->resultSetId);
225 yaz_log(log_level, "item: " ODR_INT_PRINTF, *n->resultSetItem->item);
229 Z_External *r = (Z_External*) n->itemRequest;
230 ILL_ItemRequest *item_req = 0;
231 ILL_APDU *ill_apdu = 0;
232 if (r->direct_reference)
234 char oid_name_str[OID_STR_MAX];
236 const char *oid_name =
237 yaz_oid_to_string_buf(r->direct_reference,
238 &oclass, oid_name_str);
240 yaz_log(log_level, "OID %s", oid_name);
241 if (!oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml))
243 yaz_log(log_level, "ILL XML request");
244 if (r->which == Z_External_octet)
245 yaz_log(log_level, "%.*s",
246 r->u.octet_aligned->len,
247 r->u.octet_aligned->buf);
248 xml_in_response = "<dummy>x</dummy>";
250 if (!oid_oidcmp(r->direct_reference,
251 yaz_oid_general_isoill_1))
253 yaz_log(log_level, "Decode ItemRequest begin");
254 if (r->which == ODR_EXTERNAL_single)
256 odr_setbuf(rr->decode,
257 (char *) r->u.single_ASN1_type->buf,
258 r->u.single_ASN1_type->len, 0);
260 if (!ill_ItemRequest(rr->decode, &item_req, 0, 0))
263 "Couldn't decode ItemRequest %s near %ld",
264 odr_errmsg(odr_geterror(rr->decode)),
265 (long) odr_offset(rr->decode));
268 yaz_log(log_level, "Decode ItemRequest OK");
271 ill_ItemRequest(rr->print, &item_req, 0,
273 odr_reset(rr->print);
276 if (!item_req && r->which == ODR_EXTERNAL_single)
278 yaz_log(log_level, "Decode ILL APDU begin");
279 odr_setbuf(rr->decode,
280 (char*) r->u.single_ASN1_type->buf,
281 r->u.single_ASN1_type->len, 0);
283 if (!ill_APDU(rr->decode, &ill_apdu, 0, 0))
286 "Couldn't decode ILL APDU %s near %ld",
287 odr_errmsg(odr_geterror(rr->decode)),
288 (long) odr_offset(rr->decode));
289 yaz_log(log_level, "PDU dump:");
290 odr_dumpBER(yaz_log_file(),
291 (char *) r->u.single_ASN1_type->buf,
292 r->u.single_ASN1_type->len);
295 yaz_log(log_level, "Decode ILL APDU OK");
298 ill_APDU(rr->print, &ill_apdu, 0,
300 odr_reset(rr->print);
307 yaz_log(log_level, "ILL protocol version = "
309 *item_req->protocol_version_num);
315 Z_External *ext = (Z_External *)
316 odr_malloc(rr->stream, sizeof(*ext));
317 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
318 odr_malloc(rr->stream, sizeof(*keep));
319 Z_IOTargetPart *targetPart = (Z_IOTargetPart *)
320 odr_malloc(rr->stream, sizeof(*targetPart));
322 rr->taskPackage = (Z_TaskPackage *)
323 odr_malloc(rr->stream, sizeof(*rr->taskPackage));
324 rr->taskPackage->packageType =
325 odr_oiddup(rr->stream, rr->esr->packageType);
326 rr->taskPackage->packageName = 0;
327 rr->taskPackage->userId = 0;
328 rr->taskPackage->retentionTime = 0;
329 rr->taskPackage->permissions = 0;
330 rr->taskPackage->description = 0;
331 rr->taskPackage->targetReference = (Odr_oct *)
332 odr_malloc(rr->stream, sizeof(Odr_oct));
333 rr->taskPackage->targetReference->buf =
334 (unsigned char *) odr_strdup(rr->stream, "911");
335 rr->taskPackage->targetReference->len =
336 rr->taskPackage->targetReference->size =
337 strlen((char *) (rr->taskPackage->targetReference->buf));
338 rr->taskPackage->creationDateTime = 0;
339 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
340 rr->taskPackage->packageDiagnostics = 0;
341 rr->taskPackage->taskSpecificParameters = ext;
343 ext->direct_reference =
344 odr_oiddup(rr->stream, rr->esr->packageType);
345 ext->indirect_reference = 0;
347 ext->which = Z_External_itemOrder;
348 ext->u.itemOrder = (Z_ItemOrder *)
349 odr_malloc(rr->stream, sizeof(*ext->u.update));
350 ext->u.itemOrder->which = Z_IOItemOrder_taskPackage;
351 ext->u.itemOrder->u.taskPackage = (Z_IOTaskPackage *)
352 odr_malloc(rr->stream, sizeof(Z_IOTaskPackage));
353 ext->u.itemOrder->u.taskPackage->originPart = k;
354 ext->u.itemOrder->u.taskPackage->targetPart = targetPart;
357 targetPart->itemRequest =
358 z_ext_record_xml(rr->stream, xml_in_response,
359 strlen(xml_in_response));
361 targetPart->itemRequest = 0;
363 targetPart->statusOrErrorReport = 0;
364 targetPart->auxiliaryStatus = 0;
368 else if (rr->esr->taskSpecificParameters->which == Z_External_update)
370 Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
371 yaz_log(log_level, "Received DB Update");
372 if (up->which == Z_IUUpdate_esRequest)
374 Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
375 Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
376 Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
378 yaz_log(log_level, "action");
381 switch (*toKeep->action)
383 case Z_IUOriginPartToKeep_recordInsert:
384 yaz_log(log_level, " recordInsert");
386 case Z_IUOriginPartToKeep_recordReplace:
387 yaz_log(log_level, " recordReplace");
389 case Z_IUOriginPartToKeep_recordDelete:
390 yaz_log(log_level, " recordDelete");
392 case Z_IUOriginPartToKeep_elementUpdate:
393 yaz_log(log_level, " elementUpdate");
395 case Z_IUOriginPartToKeep_specialUpdate:
396 yaz_log(log_level, " specialUpdate");
399 yaz_log(log_level, " unknown (" ODR_INT_PRINTF ")",
403 if (toKeep->databaseName)
405 yaz_log(log_level, "database: %s", toKeep->databaseName);
406 if (!strcmp(toKeep->databaseName, "fault"))
408 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
409 rr->errstring = toKeep->databaseName;
411 if (!strcmp(toKeep->databaseName, "accept"))
416 Z_External *ext = (Z_External *)
417 odr_malloc(rr->stream, sizeof(*ext));
418 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
419 odr_malloc(rr->stream, sizeof(*keep));
420 Z_IUTargetPart *targetPart = (Z_IUTargetPart *)
421 odr_malloc(rr->stream, sizeof(*targetPart));
423 rr->taskPackage = (Z_TaskPackage *)
424 odr_malloc(rr->stream, sizeof(*rr->taskPackage));
425 rr->taskPackage->packageType =
426 odr_oiddup(rr->stream, rr->esr->packageType);
427 rr->taskPackage->packageName = 0;
428 rr->taskPackage->userId = 0;
429 rr->taskPackage->retentionTime = 0;
430 rr->taskPackage->permissions = 0;
431 rr->taskPackage->description = 0;
432 rr->taskPackage->targetReference = (Odr_oct *)
433 odr_malloc(rr->stream, sizeof(Odr_oct));
434 rr->taskPackage->targetReference->buf =
435 (unsigned char *) odr_strdup(rr->stream, "123");
436 rr->taskPackage->targetReference->len =
437 rr->taskPackage->targetReference->size =
438 strlen((char *) (rr->taskPackage->targetReference->buf));
439 rr->taskPackage->creationDateTime = 0;
440 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
441 rr->taskPackage->packageDiagnostics = 0;
442 rr->taskPackage->taskSpecificParameters = ext;
444 ext->direct_reference =
445 odr_oiddup(rr->stream, rr->esr->packageType);
446 ext->indirect_reference = 0;
448 ext->which = Z_External_update;
449 ext->u.update = (Z_IUUpdate *)
450 odr_malloc(rr->stream, sizeof(*ext->u.update));
451 ext->u.update->which = Z_IUUpdate_taskPackage;
452 ext->u.update->u.taskPackage = (Z_IUUpdateTaskPackage *)
453 odr_malloc(rr->stream, sizeof(Z_IUUpdateTaskPackage));
454 ext->u.update->u.taskPackage->originPart = keep;
455 ext->u.update->u.taskPackage->targetPart = targetPart;
457 keep->action = odr_intdup(rr->stream, *toKeep->action);
459 odr_strdup(rr->stream, toKeep->databaseName);
461 keep->elementSetName = 0;
462 keep->actionQualifier = 0;
464 targetPart->updateStatus = odr_intdup(rr->stream, 1);
465 targetPart->num_globalDiagnostics = 0;
466 targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval();
467 targetPart->num_taskPackageRecords = 1;
468 targetPart->taskPackageRecords =
469 (Z_IUTaskPackageRecordStructure **)
470 odr_malloc(rr->stream,
471 sizeof(Z_IUTaskPackageRecordStructure *));
472 targetPart->taskPackageRecords[0] =
473 (Z_IUTaskPackageRecordStructure *)
474 odr_malloc(rr->stream,
475 sizeof(Z_IUTaskPackageRecordStructure));
477 targetPart->taskPackageRecords[0]->which =
478 Z_IUTaskPackageRecordStructure_record;
479 targetPart->taskPackageRecords[0]->u.record =
480 z_ext_record_sutrs(rr->stream, "test", 4);
481 targetPart->taskPackageRecords[0]->correlationInfo = 0;
482 targetPart->taskPackageRecords[0]->recordStatus =
483 odr_intdup(rr->stream,
484 Z_IUTaskPackageRecordStructure_success);
485 targetPart->taskPackageRecords[0]->num_supplementalDiagnostics
488 targetPart->taskPackageRecords[0]->supplementalDiagnostics = 0;
493 for (i = 0; i < notToKeep->num; i++)
495 Z_External *rec = notToKeep->elements[i]->record;
497 if (rec->direct_reference)
499 char oid_name_str[OID_STR_MAX];
501 = oid_name = yaz_oid_to_string_buf(
502 rec->direct_reference, 0,
505 yaz_log(log_level, "record %d type %s", i,
510 case Z_External_sutrs:
511 if (rec->u.octet_aligned->len > 170)
512 yaz_log(log_level, "%d bytes:\n%.168s ...",
516 yaz_log(log_level, "%d bytes:\n%s",
520 case Z_External_octet :
521 if (rec->u.octet_aligned->len > 170)
522 yaz_log(log_level, "%d bytes:\n%.168s ...",
523 rec->u.octet_aligned->len,
524 rec->u.octet_aligned->buf);
526 yaz_log(log_level, "%d bytes\n%s",
527 rec->u.octet_aligned->len,
528 rec->u.octet_aligned->buf);
537 /* result set delete */
538 int ztest_delete(void *handle, bend_delete_rr *rr)
540 if (rr->num_setnames == 1 && !strcmp(rr->setnames[0], "1"))
541 rr->delete_status = Z_DeleteStatus_success;
543 rr->delete_status = Z_DeleteStatus_resultSetDidNotExist;
547 /* Our sort handler really doesn't sort... */
548 int ztest_sort(void *handle, bend_sort_rr *rr)
551 rr->sort_status = Z_SortResponse_success;
556 /* present request handler */
557 int ztest_present(void *handle, bend_present_rr *rr)
562 /* retrieval of a single record (present, and piggy back search) */
563 int ztest_fetch(void *handle, bend_fetch_rr *r)
566 const Odr_oid *oid = r->request_format;
569 r->basename = "Default";
570 r->output_format = r->request_format;
572 if (!oid || yaz_oid_is_iso2709(oid))
574 cp = dummy_marc_record(r->number, r->stream);
577 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
584 r->output_format = odr_oiddup(r->stream, yaz_oid_recsyn_usmarc);
587 else if (!oid_oidcmp(oid, yaz_oid_recsyn_opac))
589 cp = dummy_marc_record(r->number, r->stream);
592 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
595 r->record = (char *) dummy_opac(r->number, r->stream, cp);
598 else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
600 /* this section returns a small record */
603 sprintf(buf, "This is dummy SUTRS record number %d\n", r->number);
605 r->len = strlen(buf);
606 r->record = (char *) odr_malloc(r->stream, r->len+1);
607 strcpy(r->record, buf);
609 else if (!oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
612 r->record = (char*) dummy_grs_record(r->number, r->stream);
615 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
619 else if (!oid_oidcmp(oid, yaz_oid_recsyn_postscript))
625 sprintf(fname, "part.%d.ps", r->number);
626 f = fopen(fname, "rb");
629 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
632 fseek(f, 0L, SEEK_END);
634 if (size <= 0 || size >= 5000000)
636 r->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
638 fseek(f, 0L, SEEK_SET);
639 r->record = (char*) odr_malloc(r->stream, size);
641 if (fread(r->record, size, 1, f) != 1)
643 r->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
647 else if (!oid_oidcmp(oid, yaz_oid_recsyn_xml))
649 if ((cp = dummy_xml_record(r->number, r->stream)))
656 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
657 r->surrogate_flag = 1;
663 char buf[OID_STR_MAX];
664 r->errcode = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
665 r->errstring = odr_strdup(r->stream, oid_oid_to_dotstring(oid, buf));
673 * silly dummy-scan what reads words from a file.
675 int ztest_scan(void *handle, bend_scan_rr *q)
678 static struct scan_entry list[200];
679 static char entries[200][80];
683 int term_position_req = q->term_position;
684 int num_entries_req = q->num_entries;
686 /* Throw Database unavailable if other than Default or Slow */
687 if (!yaz_matchstr(q->basenames[0], "Default"))
688 ; /* Default is OK in our test */
689 else if (check_slow(q->basenames[0], 0 /* no assoc for scan */))
693 q->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
694 q->errstring = q->basenames[0];
701 q->status = BEND_SCAN_SUCCESS;
702 if (!f && !(f = fopen("dummy-words", "r")))
704 perror("dummy-words");
707 if (q->num_entries > 200)
709 q->errcode = YAZ_BIB1_RESOURCES_EXHAUSTED_NO_RESULTS_AVAILABLE;
715 if (q->term->term->which != Z_Term_general)
717 q->errcode = YAZ_BIB1_TERM_TYPE_UNSUPP;
720 if (*q->step_size != 0)
722 q->errcode = YAZ_BIB1_ONLY_ZERO_STEP_SIZE_SUPPORTED_FOR_SCAN;
725 len = q->term->term->u.general->len;
726 if (len >= (int ) sizeof(term))
727 len = sizeof(term)-1;
728 memcpy(term, q->term->term->u.general->buf, len);
731 else if (q->scanClause)
733 strncpy(term, q->scanClause, sizeof(term)-1);
734 term[sizeof(term)-1] = '\0';
739 for (p = term; *p; p++)
740 if (islower(*(unsigned char *) p))
743 fseek(f, 0, SEEK_SET);
746 for (i = 0, pos = 0; fscanf(f, " %79[^:]:%d", entries[pos], &hits[pos]) == 2;
747 i++, pos < 199 ? pos++ : (pos = 0))
749 if (!q->num_entries && strcmp(entries[pos], term) >= 0) /* s-point fnd */
751 if ((q->term_position = term_position_req) > i + 1)
753 q->term_position = i + 1;
754 q->status = BEND_SCAN_PARTIAL;
756 for (; q->num_entries < q->term_position; q->num_entries++)
760 po = pos - q->term_position + q->num_entries+1; /* find pos */
764 if (!strcmp(term, "SD") && q->num_entries == 2)
766 list[q->num_entries].term = entries[pos];
767 list[q->num_entries].occurrences = -1;
768 list[q->num_entries].errcode =
769 YAZ_BIB1_SCAN_UNSUPP_VALUE_OF_POSITION_IN_RESPONSE;
770 list[q->num_entries].errstring = "SD for Scan Term";
774 list[q->num_entries].term = entries[po];
775 list[q->num_entries].occurrences = hits[po];
779 else if (q->num_entries)
781 list[q->num_entries].term = entries[pos];
782 list[q->num_entries].occurrences = hits[pos];
785 if (q->num_entries >= num_entries_req)
789 q->status = BEND_SCAN_PARTIAL;
793 int ztest_explain(void *handle, bend_explain_rr *rr)
795 if (rr->database && !strcmp(rr->database, "Default"))
797 rr->explain_buf = "<explain>\n"
799 "\t\t<host>localhost</host>\n"
800 "\t\t<port>210</port>\n"
807 int ztest_update(void *handle, bend_update_rr *rr)
809 rr->operation_status = "success";
813 bend_initresult *bend_init(bend_initrequest *q)
815 bend_initresult *r = (bend_initresult *)
816 odr_malloc(q->stream, sizeof(*r));
817 int *counter = (int *) xmalloc(sizeof(int));
821 log_level=yaz_log_module_level("ztest");
828 r->handle = counter; /* user handle, in this case a simple int */
829 q->bend_sort = ztest_sort; /* register sort handler */
830 q->bend_search = ztest_search; /* register search handler */
831 q->bend_present = ztest_present; /* register present handle */
832 q->bend_esrequest = ztest_esrequest;
833 q->bend_delete = ztest_delete;
834 q->bend_fetch = ztest_fetch;
835 q->bend_scan = ztest_scan;
837 q->bend_explain = ztest_explain;
839 q->bend_srw_scan = ztest_scan;
840 q->bend_srw_update = ztest_update;
842 q->query_charset = "ISO-8859-1";
843 q->records_in_same_charset = 0;
848 void bend_close(void *handle)
850 xfree(handle); /* release our user-defined handle */
854 int main(int argc, char **argv)
856 return statserv_main(argc, argv, bend_init, bend_close);
861 * c-file-style: "Stroustrup"
862 * indent-tabs-mode: nil
864 * vim: shiftwidth=4 tabstop=8 expandtab