1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 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')
56 WRBUF hits_str = wrbuf_alloc();
57 wrbuf_write(hits_str, (const char *) oct->buf, oct->len);
58 h = odr_atoi(wrbuf_cstr(hits_str));
59 wrbuf_destroy(hits_str);
64 case Z_RPNStructure_complex:
65 h = get_term_hit(s->u.complex->s1);
67 h = get_term_hit(s->u.complex->s2);
73 /** \brief gets hit count for numeric terms in RPN queries
75 \return number of hits (random or number for term)
77 This is just for testing.. A real database of course uses
78 the content of a database to establish a value.. In our case, we
79 have a way to trigger a certain hit count. Good for testing of
80 client applications etc
82 static Odr_int get_hit_count(Z_Query *q)
85 if (q->which == Z_Query_type_1 || q->which == Z_Query_type_101)
86 h = get_term_hit(q->u.type_1->RPNStructure);
92 /** \brief checks if it's a dummy Slow database..
93 \param basename database name to check
94 \param association backend association (or NULL if not available)
95 \retval 1 is slow database
96 \retval 0 is not a slow database
98 The Slow database is for testing.. It allows us to simulate
101 static int check_slow(const char *basename, bend_association association)
103 if (strncmp(basename, "Slow", 4) == 0)
108 sscanf(basename+4, "%d", &w);
109 /* wait up to 3 seconds and check if connection is still alive */
110 for (i = 0; i < w; i++)
112 if (association && !bend_assoc_is_alive(association))
114 yaz_log(YLOG_LOG, "search aborted");
125 int ztest_search(void *handle, bend_search_rr *rr)
127 if (rr->num_bases != 1)
129 rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP;
132 /* Throw Database unavailable if other than Default or Slow */
133 if (!yaz_matchstr(rr->basenames[0], "Default"))
134 ; /* Default is OK in our test */
135 else if (check_slow(rr->basenames[0], rr->association))
137 rr->estimated_hit_count = 1;
141 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
142 rr->errstring = rr->basenames[0];
149 WRBUF response_xml = wrbuf_alloc();
150 wrbuf_puts(response_xml, "<extra>");
151 for (a = rr->extra_args; a; a = a->next)
153 wrbuf_puts(response_xml, "<extra name=\"");
154 wrbuf_xmlputs(response_xml, a->name);
155 wrbuf_puts(response_xml, "\"");
158 wrbuf_puts(response_xml, " value=\"");
159 wrbuf_xmlputs(response_xml, a->value);
160 wrbuf_puts(response_xml, "\"");
162 wrbuf_puts(response_xml, "/>");
164 wrbuf_puts(response_xml, "</extra>");
165 rr->extra_response_data =
166 odr_strdup(rr->stream, wrbuf_cstr(response_xml));
167 wrbuf_destroy(response_xml);
169 rr->hits = get_hit_count(rr->query);
174 /* this huge function handles extended services */
175 int ztest_esrequest(void *handle, bend_esrequest_rr *rr)
177 /* user-defined handle - created in bend_init */
178 int *counter = (int*) handle;
180 yaz_log(log_level, "ESRequest no %d", *counter);
184 if (rr->esr->packageName)
185 yaz_log(log_level, "packagename: %s", rr->esr->packageName);
186 yaz_log(log_level, "Waitaction: " ODR_INT_PRINTF, *rr->esr->waitAction);
189 yaz_log(log_level, "function: " ODR_INT_PRINTF, *rr->esr->function);
191 if (!rr->esr->taskSpecificParameters)
193 yaz_log(log_level, "No task specific parameters");
195 else if (rr->esr->taskSpecificParameters->which == Z_External_itemOrder)
197 Z_ItemOrder *it = rr->esr->taskSpecificParameters->u.itemOrder;
198 yaz_log(log_level, "Received ItemOrder");
199 if (it->which == Z_IOItemOrder_esRequest)
201 Z_IORequest *ir = it->u.esRequest;
202 Z_IOOriginPartToKeep *k = ir->toKeep;
203 Z_IOOriginPartNotToKeep *n = ir->notToKeep;
204 const char *xml_in_response = 0;
208 if (k->contact->name)
209 yaz_log(log_level, "contact name %s", k->contact->name);
210 if (k->contact->phone)
211 yaz_log(log_level, "contact phone %s", k->contact->phone);
212 if (k->contact->email)
213 yaz_log(log_level, "contact email %s", k->contact->email);
217 yaz_log(log_level, "Billing info (not shown)");
220 if (n->resultSetItem)
222 yaz_log(log_level, "resultsetItem");
223 yaz_log(log_level, "setId: %s", n->resultSetItem->resultSetId);
224 yaz_log(log_level, "item: " ODR_INT_PRINTF, *n->resultSetItem->item);
228 Z_External *r = (Z_External*) n->itemRequest;
229 ILL_ItemRequest *item_req = 0;
230 ILL_APDU *ill_apdu = 0;
231 if (r->direct_reference)
233 char oid_name_str[OID_STR_MAX];
235 const char *oid_name =
236 yaz_oid_to_string_buf(r->direct_reference,
237 &oclass, oid_name_str);
239 yaz_log(log_level, "OID %s", oid_name);
240 if (!oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml))
242 yaz_log(log_level, "ILL XML request");
243 if (r->which == Z_External_octet)
244 yaz_log(log_level, "%.*s",
245 r->u.octet_aligned->len,
246 r->u.octet_aligned->buf);
247 xml_in_response = "<dummy>x</dummy>";
249 if (!oid_oidcmp(r->direct_reference,
250 yaz_oid_general_isoill_1))
252 yaz_log(log_level, "Decode ItemRequest begin");
253 if (r->which == ODR_EXTERNAL_single)
255 odr_setbuf(rr->decode,
256 (char *) r->u.single_ASN1_type->buf,
257 r->u.single_ASN1_type->len, 0);
259 if (!ill_ItemRequest(rr->decode, &item_req, 0, 0))
262 "Couldn't decode ItemRequest %s near %ld",
263 odr_errmsg(odr_geterror(rr->decode)),
264 (long) odr_offset(rr->decode));
267 yaz_log(log_level, "Decode ItemRequest OK");
270 ill_ItemRequest(rr->print, &item_req, 0,
272 odr_reset(rr->print);
275 if (!item_req && r->which == ODR_EXTERNAL_single)
277 yaz_log(log_level, "Decode ILL APDU begin");
278 odr_setbuf(rr->decode,
279 (char*) r->u.single_ASN1_type->buf,
280 r->u.single_ASN1_type->len, 0);
282 if (!ill_APDU(rr->decode, &ill_apdu, 0, 0))
285 "Couldn't decode ILL APDU %s near %ld",
286 odr_errmsg(odr_geterror(rr->decode)),
287 (long) odr_offset(rr->decode));
288 yaz_log(log_level, "PDU dump:");
289 odr_dumpBER(yaz_log_file(),
290 (char *) r->u.single_ASN1_type->buf,
291 r->u.single_ASN1_type->len);
294 yaz_log(log_level, "Decode ILL APDU OK");
297 ill_APDU(rr->print, &ill_apdu, 0,
299 odr_reset(rr->print);
306 yaz_log(log_level, "ILL protocol version = "
308 *item_req->protocol_version_num);
314 Z_External *ext = (Z_External *)
315 odr_malloc(rr->stream, sizeof(*ext));
316 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
317 odr_malloc(rr->stream, sizeof(*keep));
318 Z_IOTargetPart *targetPart = (Z_IOTargetPart *)
319 odr_malloc(rr->stream, sizeof(*targetPart));
321 rr->taskPackage = (Z_TaskPackage *)
322 odr_malloc(rr->stream, sizeof(*rr->taskPackage));
323 rr->taskPackage->packageType =
324 odr_oiddup(rr->stream, rr->esr->packageType);
325 rr->taskPackage->packageName = 0;
326 rr->taskPackage->userId = 0;
327 rr->taskPackage->retentionTime = 0;
328 rr->taskPackage->permissions = 0;
329 rr->taskPackage->description = 0;
330 rr->taskPackage->targetReference = (Odr_oct *)
331 odr_malloc(rr->stream, sizeof(Odr_oct));
332 rr->taskPackage->targetReference->buf =
333 (unsigned char *) odr_strdup(rr->stream, "911");
334 rr->taskPackage->targetReference->len =
335 rr->taskPackage->targetReference->size =
336 strlen((char *) (rr->taskPackage->targetReference->buf));
337 rr->taskPackage->creationDateTime = 0;
338 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
339 rr->taskPackage->packageDiagnostics = 0;
340 rr->taskPackage->taskSpecificParameters = ext;
342 ext->direct_reference =
343 odr_oiddup(rr->stream, rr->esr->packageType);
344 ext->indirect_reference = 0;
346 ext->which = Z_External_itemOrder;
347 ext->u.itemOrder = (Z_ItemOrder *)
348 odr_malloc(rr->stream, sizeof(*ext->u.update));
349 ext->u.itemOrder->which = Z_IOItemOrder_taskPackage;
350 ext->u.itemOrder->u.taskPackage = (Z_IOTaskPackage *)
351 odr_malloc(rr->stream, sizeof(Z_IOTaskPackage));
352 ext->u.itemOrder->u.taskPackage->originPart = k;
353 ext->u.itemOrder->u.taskPackage->targetPart = targetPart;
356 targetPart->itemRequest =
357 z_ext_record_xml(rr->stream, xml_in_response,
358 strlen(xml_in_response));
360 targetPart->itemRequest = 0;
362 targetPart->statusOrErrorReport = 0;
363 targetPart->auxiliaryStatus = 0;
367 else if (rr->esr->taskSpecificParameters->which == Z_External_update)
369 Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
370 yaz_log(log_level, "Received DB Update");
371 if (up->which == Z_IUUpdate_esRequest)
373 Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
374 Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
375 Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
377 yaz_log(log_level, "action");
380 switch (*toKeep->action)
382 case Z_IUOriginPartToKeep_recordInsert:
383 yaz_log(log_level, " recordInsert");
385 case Z_IUOriginPartToKeep_recordReplace:
386 yaz_log(log_level, " recordReplace");
388 case Z_IUOriginPartToKeep_recordDelete:
389 yaz_log(log_level, " recordDelete");
391 case Z_IUOriginPartToKeep_elementUpdate:
392 yaz_log(log_level, " elementUpdate");
394 case Z_IUOriginPartToKeep_specialUpdate:
395 yaz_log(log_level, " specialUpdate");
398 yaz_log(log_level, " unknown (" ODR_INT_PRINTF ")",
402 if (toKeep->databaseName)
404 yaz_log(log_level, "database: %s", toKeep->databaseName);
405 if (!strcmp(toKeep->databaseName, "fault"))
407 rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
408 rr->errstring = toKeep->databaseName;
410 if (!strcmp(toKeep->databaseName, "accept"))
415 Z_External *ext = (Z_External *)
416 odr_malloc(rr->stream, sizeof(*ext));
417 Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
418 odr_malloc(rr->stream, sizeof(*keep));
419 Z_IUTargetPart *targetPart = (Z_IUTargetPart *)
420 odr_malloc(rr->stream, sizeof(*targetPart));
422 rr->taskPackage = (Z_TaskPackage *)
423 odr_malloc(rr->stream, sizeof(*rr->taskPackage));
424 rr->taskPackage->packageType =
425 odr_oiddup(rr->stream, rr->esr->packageType);
426 rr->taskPackage->packageName = 0;
427 rr->taskPackage->userId = 0;
428 rr->taskPackage->retentionTime = 0;
429 rr->taskPackage->permissions = 0;
430 rr->taskPackage->description = 0;
431 rr->taskPackage->targetReference = (Odr_oct *)
432 odr_malloc(rr->stream, sizeof(Odr_oct));
433 rr->taskPackage->targetReference->buf =
434 (unsigned char *) odr_strdup(rr->stream, "123");
435 rr->taskPackage->targetReference->len =
436 rr->taskPackage->targetReference->size =
437 strlen((char *) (rr->taskPackage->targetReference->buf));
438 rr->taskPackage->creationDateTime = 0;
439 rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
440 rr->taskPackage->packageDiagnostics = 0;
441 rr->taskPackage->taskSpecificParameters = ext;
443 ext->direct_reference =
444 odr_oiddup(rr->stream, rr->esr->packageType);
445 ext->indirect_reference = 0;
447 ext->which = Z_External_update;
448 ext->u.update = (Z_IUUpdate *)
449 odr_malloc(rr->stream, sizeof(*ext->u.update));
450 ext->u.update->which = Z_IUUpdate_taskPackage;
451 ext->u.update->u.taskPackage = (Z_IUUpdateTaskPackage *)
452 odr_malloc(rr->stream, sizeof(Z_IUUpdateTaskPackage));
453 ext->u.update->u.taskPackage->originPart = keep;
454 ext->u.update->u.taskPackage->targetPart = targetPart;
456 keep->action = odr_intdup(rr->stream, *toKeep->action);
458 odr_strdup(rr->stream, toKeep->databaseName);
460 keep->elementSetName = 0;
461 keep->actionQualifier = 0;
463 targetPart->updateStatus = odr_intdup(rr->stream, 1);
464 targetPart->num_globalDiagnostics = 0;
465 targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval();
466 targetPart->num_taskPackageRecords = 1;
467 targetPart->taskPackageRecords =
468 (Z_IUTaskPackageRecordStructure **)
469 odr_malloc(rr->stream,
470 sizeof(Z_IUTaskPackageRecordStructure *));
471 targetPart->taskPackageRecords[0] =
472 (Z_IUTaskPackageRecordStructure *)
473 odr_malloc(rr->stream,
474 sizeof(Z_IUTaskPackageRecordStructure));
476 targetPart->taskPackageRecords[0]->which =
477 Z_IUTaskPackageRecordStructure_record;
478 targetPart->taskPackageRecords[0]->u.record =
479 z_ext_record_sutrs(rr->stream, "test", 4);
480 targetPart->taskPackageRecords[0]->correlationInfo = 0;
481 targetPart->taskPackageRecords[0]->recordStatus =
482 odr_intdup(rr->stream,
483 Z_IUTaskPackageRecordStructure_success);
484 targetPart->taskPackageRecords[0]->num_supplementalDiagnostics
487 targetPart->taskPackageRecords[0]->supplementalDiagnostics = 0;
492 for (i = 0; i < notToKeep->num; i++)
494 Z_External *rec = notToKeep->elements[i]->record;
496 if (rec->direct_reference)
498 char oid_name_str[OID_STR_MAX];
500 = oid_name = yaz_oid_to_string_buf(
501 rec->direct_reference, 0,
504 yaz_log(log_level, "record %d type %s", i,
509 case Z_External_sutrs:
510 if (rec->u.octet_aligned->len > 170)
511 yaz_log(log_level, "%d bytes:\n%.168s ...",
515 yaz_log(log_level, "%d bytes:\n%s",
519 case Z_External_octet :
520 if (rec->u.octet_aligned->len > 170)
521 yaz_log(log_level, "%d bytes:\n%.168s ...",
522 rec->u.octet_aligned->len,
523 rec->u.octet_aligned->buf);
525 yaz_log(log_level, "%d bytes\n%s",
526 rec->u.octet_aligned->len,
527 rec->u.octet_aligned->buf);
536 /* result set delete */
537 int ztest_delete(void *handle, bend_delete_rr *rr)
539 if (rr->num_setnames == 1 && !strcmp(rr->setnames[0], "1"))
540 rr->delete_status = Z_DeleteStatus_success;
542 rr->delete_status = Z_DeleteStatus_resultSetDidNotExist;
546 /* Our sort handler really doesn't sort... */
547 int ztest_sort(void *handle, bend_sort_rr *rr)
550 rr->sort_status = Z_SortResponse_success;
555 /* present request handler */
556 int ztest_present(void *handle, bend_present_rr *rr)
561 /* retrieval of a single record (present, and piggy back search) */
562 int ztest_fetch(void *handle, bend_fetch_rr *r)
565 const Odr_oid *oid = r->request_format;
568 r->basename = "Default";
569 r->output_format = r->request_format;
571 if (!oid || yaz_oid_is_iso2709(oid))
573 cp = dummy_marc_record(r->number, r->stream);
576 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
583 r->output_format = odr_oiddup(r->stream, yaz_oid_recsyn_usmarc);
586 else if (!oid_oidcmp(oid, yaz_oid_recsyn_opac))
588 cp = dummy_marc_record(r->number, r->stream);
591 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
594 r->record = (char *) dummy_opac(r->number, r->stream, cp);
597 else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs))
599 /* this section returns a small record */
602 sprintf(buf, "This is dummy SUTRS record number %d\n", r->number);
604 r->len = strlen(buf);
605 r->record = (char *) odr_malloc(r->stream, r->len+1);
606 strcpy(r->record, buf);
608 else if (!oid_oidcmp(oid, yaz_oid_recsyn_grs_1))
611 r->record = (char*) dummy_grs_record(r->number, r->stream);
614 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
618 else if (!oid_oidcmp(oid, yaz_oid_recsyn_postscript))
624 sprintf(fname, "part.%d.ps", r->number);
625 f = fopen(fname, "rb");
628 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
631 fseek(f, 0L, SEEK_END);
633 if (size <= 0 || size >= 5000000)
635 r->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
637 fseek(f, 0L, SEEK_SET);
638 r->record = (char*) odr_malloc(r->stream, size);
640 if (fread(r->record, size, 1, f) != 1)
642 r->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
646 else if (!oid_oidcmp(oid, yaz_oid_recsyn_xml))
648 if ((cp = dummy_xml_record(r->number, r->stream)))
655 r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE;
656 r->surrogate_flag = 1;
662 char buf[OID_STR_MAX];
663 r->errcode = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
664 r->errstring = odr_strdup(r->stream, oid_oid_to_dotstring(oid, buf));
672 * silly dummy-scan what reads words from a file.
674 int ztest_scan(void *handle, bend_scan_rr *q)
677 static struct scan_entry list[200];
678 static char entries[200][80];
682 int term_position_req = q->term_position;
683 int num_entries_req = q->num_entries;
685 /* Throw Database unavailable if other than Default or Slow */
686 if (!yaz_matchstr(q->basenames[0], "Default"))
687 ; /* Default is OK in our test */
688 else if (check_slow(q->basenames[0], 0 /* no assoc for scan */))
692 q->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
693 q->errstring = q->basenames[0];
700 q->status = BEND_SCAN_SUCCESS;
701 if (!f && !(f = fopen("dummy-words", "r")))
703 perror("dummy-words");
706 if (q->num_entries > 200)
708 q->errcode = YAZ_BIB1_RESOURCES_EXHAUSTED_NO_RESULTS_AVAILABLE;
714 if (q->term->term->which != Z_Term_general)
716 q->errcode = YAZ_BIB1_TERM_TYPE_UNSUPP;
719 if (*q->step_size != 0)
721 q->errcode = YAZ_BIB1_ONLY_ZERO_STEP_SIZE_SUPPORTED_FOR_SCAN;
724 len = q->term->term->u.general->len;
725 if (len >= sizeof(term))
726 len = sizeof(term)-1;
727 memcpy(term, q->term->term->u.general->buf, len);
730 else if (q->scanClause)
732 strncpy(term, q->scanClause, sizeof(term)-1);
733 term[sizeof(term)-1] = '\0';
738 for (p = term; *p; p++)
739 if (islower(*(unsigned char *) p))
742 fseek(f, 0, SEEK_SET);
745 for (i = 0, pos = 0; fscanf(f, " %79[^:]:%d", entries[pos], &hits[pos]) == 2;
746 i++, pos < 199 ? pos++ : (pos = 0))
748 if (!q->num_entries && strcmp(entries[pos], term) >= 0) /* s-point fnd */
750 if ((q->term_position = term_position_req) > i + 1)
752 q->term_position = i + 1;
753 q->status = BEND_SCAN_PARTIAL;
755 for (; q->num_entries < q->term_position; q->num_entries++)
759 po = pos - q->term_position + q->num_entries+1; /* find pos */
763 if (!strcmp(term, "SD") && q->num_entries == 2)
765 list[q->num_entries].term = entries[pos];
766 list[q->num_entries].occurrences = -1;
767 list[q->num_entries].errcode =
768 YAZ_BIB1_SCAN_UNSUPP_VALUE_OF_POSITION_IN_RESPONSE;
769 list[q->num_entries].errstring = "SD for Scan Term";
773 list[q->num_entries].term = entries[po];
774 list[q->num_entries].occurrences = hits[po];
778 else if (q->num_entries)
780 list[q->num_entries].term = entries[pos];
781 list[q->num_entries].occurrences = hits[pos];
784 if (q->num_entries >= num_entries_req)
788 q->status = BEND_SCAN_PARTIAL;
792 int ztest_explain(void *handle, bend_explain_rr *rr)
794 if (rr->database && !strcmp(rr->database, "Default"))
796 rr->explain_buf = "<explain>\n"
798 "\t\t<host>localhost</host>\n"
799 "\t\t<port>210</port>\n"
806 int ztest_update(void *handle, bend_update_rr *rr)
808 rr->operation_status = "success";
812 bend_initresult *bend_init(bend_initrequest *q)
814 bend_initresult *r = (bend_initresult *)
815 odr_malloc(q->stream, sizeof(*r));
816 int *counter = (int *) xmalloc(sizeof(int));
820 log_level=yaz_log_module_level("ztest");
827 r->handle = counter; /* user handle, in this case a simple int */
828 q->bend_sort = ztest_sort; /* register sort handler */
829 q->bend_search = ztest_search; /* register search handler */
830 q->bend_present = ztest_present; /* register present handle */
831 q->bend_esrequest = ztest_esrequest;
832 q->bend_delete = ztest_delete;
833 q->bend_fetch = ztest_fetch;
834 q->bend_scan = ztest_scan;
836 q->bend_explain = ztest_explain;
838 q->bend_srw_scan = ztest_scan;
839 q->bend_srw_update = ztest_update;
841 q->query_charset = "ISO-8859-1";
842 q->records_in_same_charset = 0;
847 void bend_close(void *handle)
849 xfree(handle); /* release our user-defined handle */
853 int main(int argc, char **argv)
855 return statserv_main(argc, argv, bend_init, bend_close);
860 * c-file-style: "Stroustrup"
861 * indent-tabs-mode: nil
863 * vim: shiftwidth=4 tabstop=8 expandtab