X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ztest%2Fztest.c;h=76dd4599015ab986113be76f4a6b97055be502f8;hp=fb9fd8dad82c4a2313b368f3fe67cd1530252bd3;hb=4e6d194a80ae85760471a2fe7568bfaeb18649dd;hpb=a341ccc0007ba1c05ac5a14a9f1cf92f7b576245 diff --git a/ztest/ztest.c b/ztest/ztest.c index fb9fd8d..76dd459 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -3,8 +3,8 @@ * See the file LICENSE for details. */ -/* - * Demonstration of simple server +/** \file + * \brief Demonstration of server */ #include @@ -30,8 +30,9 @@ int ztest_present(void *handle, bend_present_rr *rr); int ztest_esrequest(void *handle, bend_esrequest_rr *rr); int ztest_delete(void *handle, bend_delete_rr *rr); -/** \fn get_term_hit - \brief use term value as hit count +/** \brief use term value as hit count + \param s RPN structure + \return >= 0: search term number or -1: not found Traverse RPN tree 'in order' and use term value as hit count. Only terms that looks a numeric is used.. Returns -1 if @@ -63,8 +64,9 @@ static int get_term_hit(Z_RPNStructure *s) return h; } -/** \fn get_hit_count - \brief gets hit count for numeric terms in RPN queries +/** \brief gets hit count for numeric terms in RPN queries + \param q RPN Query + \return number of hits (random or number for term) This is just for testing.. A real database of course uses the content of a database to establish a value.. In our case, we @@ -533,59 +535,14 @@ int ztest_fetch(void *handle, bend_fetch_rr *r) } else if (!oid_oidcmp(oid, yaz_oid_recsyn_opac)) { - Z_OPACRecord *rec; - int i; cp = dummy_marc_record(r->number, r->stream); if (!cp) { r->errcode = YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE; return 0; } - rec = odr_malloc(r->stream, sizeof(*rec)); - rec->bibliographicRecord = - z_ext_record_usmarc(r->stream, cp, strlen(cp)); - rec->num_holdingsData = 1; - rec->holdingsData = odr_malloc(r->stream, sizeof(*rec->holdingsData)); - for (i = 0; i < rec->num_holdingsData; i++) - { - Z_HoldingsRecord *hr = odr_malloc(r->stream, sizeof(*hr)); - Z_HoldingsAndCircData *hc = odr_malloc(r->stream, sizeof(*hc)); - - rec->holdingsData[i] = hr; - hr->which = Z_HoldingsRecord_holdingsAndCirc; - hr->u.holdingsAndCirc = hc; - - hc->typeOfRecord = odr_strdup(r->stream, "x"); - hc->typeOfRecord[0] = cp[5]; /* LDR 6 */ - - hc->encodingLevel = odr_strdup(r->stream, "x"); - hc->encodingLevel[0] = cp[16]; /* LDR 17 */ - - hc->format = 0; /* OPT */ - hc->receiptAcqStatus = 0; /* OPT */ - hc->generalRetention = 0; /* OPT */ - hc->completeness = 0; /* OPT */ - hc->dateOfReport = 0; /* OPT */ - hc->nucCode = 0; /* OPT */ - hc->localLocation = 0; /* OPT */ - hc->shelvingLocation = 0; /* OPT */ - hc->callNumber = 0; /* OPT */ - hc->shelvingData = 0; /* OPT */ - hc->copyNumber = 0; /* OPT */ - hc->publicNote = 0; /* OPT */ - hc->reproductionNote = 0; /* OPT */ - hc->termsUseRepro = 0; /* OPT */ - hc->enumAndChron = 0; /* OPT */ - - hc->num_volumes = 0; - hc->volumes = 0; - - hc->num_circulationData = 0; - hc->circulationData = 0; - } - + r->record = (char *) dummy_opac(r->number, r->stream, cp); r->len = -1; - r->record = (char*) rec; } else if (!oid_oidcmp(oid, yaz_oid_recsyn_sutrs)) {