From 2c185557bb24fa795cee97d813074932e8cc6f78 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 27 May 1999 13:02:20 +0000 Subject: [PATCH] Assigned OID for old DB Update (VAL_DBUPDATE0). --- CHANGELOG | 3 ++ include/oid.h | 3 +- server/seshigh.c | 9 +++--- util/oid.c | 7 ++++- ztest/ztest.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 97 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ee81630..0a96925 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Possible compatibility problems with earlier versions marked with '*'. +Assigned OID for old DB Update (VAL_DBUPDATE0). Updated YAZ compiled +version so that it supports both new - and old version of DB Update + * Added 'name' parameter to ODR encoder/decoder routines to facilitate pretty ODR print. Updated whole Z39.50 encoder/decoder to reflect the change. The name parameter can be set to 0 in which no name is specified diff --git a/include/oid.h b/include/oid.h index 743235a..bb95414 100644 --- a/include/oid.h +++ b/include/oid.h @@ -23,7 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * - * $Id: oid.h,v 1.32 1999-04-20 09:56:48 adam Exp $ + * $Id: oid.h,v 1.33 1999-05-27 13:02:20 adam Exp $ */ #ifndef OID_H @@ -118,6 +118,7 @@ typedef enum oid_value VAL_PQUERY, VAL_PCQUERY, VAL_ITEMORDER, + VAL_DBUPDATE0, VAL_DBUPDATE, VAL_EXPORTSPEC, VAL_EXPORTINV, diff --git a/server/seshigh.c b/server/seshigh.c index faa1f63..78d65d8 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.89 1999-05-26 15:24:26 adam + * Revision 1.90 1999-05-27 13:02:20 adam + * Assigned OID for old DB Update (VAL_DBUPDATE0). + * + * Revision 1.89 1999/05/26 15:24:26 adam * Fixed minor bugs regarding DB Update (introduced by previous commit). * * Revision 1.88 1999/04/20 09:56:48 adam @@ -1027,7 +1030,6 @@ static Z_Records *pack_records(association *a, char *setname, int start, int *next, int *pres, oid_value format, Z_ReferenceId *referenceId) { - int oid[OID_SIZE]; int recno, total_length = 0, toget = *num, dumped_records = 0; Z_Records *records = (Z_Records *) odr_malloc (a->encode, sizeof(*records)); @@ -1035,7 +1037,6 @@ static Z_Records *pack_records(association *a, char *setname, int start, (Z_NamePlusRecordList *) odr_malloc (a->encode, sizeof(*reclist)); Z_NamePlusRecord **list = (Z_NamePlusRecord **) odr_malloc (a->encode, sizeof(*list) * toget); - oident recform; records->which = Z_Records_DBOSD; records->u.databaseOrSurDiagnostics = reclist; @@ -1053,9 +1054,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, bend_fetchrequest freq; bend_fetchresult *fres; Z_NamePlusRecord *thisrec; - Z_DatabaseRecord *thisext; int this_length = 0; - /* * we get the number of bytes allocated on the stream before any * allocation done by the backend - this should give us a reasonable diff --git a/util/oid.c b/util/oid.c index b503d03..95c5846 100644 --- a/util/oid.c +++ b/util/oid.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: oid.c,v $ - * Revision 1.35 1999-04-20 09:56:49 adam + * Revision 1.36 1999-05-27 13:02:20 adam + * Assigned OID for old DB Update (VAL_DBUPDATE0). + * + * Revision 1.35 1999/04/20 09:56:49 adam * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun). * Modified all encoders/decoders to reflect this change. * @@ -305,6 +308,8 @@ static oident oids[] = "Per'd query"}, {PROTO_Z3950, CLASS_EXTSERV, VAL_ITEMORDER, {9,4,-1}, "Item order"}, + {PROTO_Z3950, CLASS_EXTSERV, VAL_DBUPDATE0, {9,5,1,-1}, + "DB. Update (old version)"}, {PROTO_Z3950, CLASS_EXTSERV, VAL_DBUPDATE, {9,5,1,1,-1}, "DB. Update"}, {PROTO_Z3950, CLASS_EXTSERV, VAL_EXPORTSPEC, {9,6,-1}, diff --git a/ztest/ztest.c b/ztest/ztest.c index ee4ce6d..0064e69 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.22 1999-05-26 13:49:12 adam + * Revision 1.23 1999-05-27 13:02:20 adam + * Assigned OID for old DB Update (VAL_DBUPDATE0). + * + * Revision 1.22 1999/05/26 13:49:12 adam * DB Update implemented in client (very basic). * * Revision 1.21 1998/12/15 12:45:42 adam @@ -138,6 +141,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) else if (rr->esr->taskSpecificParameters->which == Z_External_itemOrder) { Z_ItemOrder *it = rr->esr->taskSpecificParameters->u.itemOrder; + logf (LOG_LOG, "Received ItemOrder"); switch (it->which) { #ifdef ASN_COMPILED @@ -174,10 +178,87 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) break; } } + else if (rr->esr->taskSpecificParameters->which == Z_External_update) + { + Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update; + logf (LOG_LOG, "Received DB Update"); + if (up->which == Z_IUUpdate_esRequest) + { + Z_IUUpdateEsRequest *esRequest = up->u.esRequest; + Z_IUOriginPartToKeep *toKeep = esRequest->toKeep; + Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep; + + logf (LOG_LOG, "action"); + if (toKeep->action) + { + switch (*toKeep->action) + { + case Z_IUOriginPartToKeep_recordInsert: + logf (LOG_LOG, " recordInsert"); + break; + case Z_IUOriginPartToKeep_recordReplace: + logf (LOG_LOG, " recordUpdate"); + break; + case Z_IUOriginPartToKeep_recordDelete: + logf (LOG_LOG, " recordDelete"); + break; + case Z_IUOriginPartToKeep_elementUpdate: + logf (LOG_LOG, " elementUpdate"); + break; + case Z_IUOriginPartToKeep_specialUpdate: + logf (LOG_LOG, " specialUpdate"); + break; + default: + logf (LOG_LOG, " unknown (%d)", *toKeep->action); + } + } + logf (LOG_LOG, "database: %s", + (toKeep->databaseName ? toKeep->databaseName : "")); + if (notToKeep) + { + int i; + for (i = 0; i < notToKeep->num; i++) + { + Z_External *rec = notToKeep->elements[i]->record; + + if (rec->direct_reference) + { + struct oident *oident; + oident = oid_getentbyoid(rec->direct_reference); + if (oident) + logf (LOG_LOG, "record %d type %s", i, + oident->desc); + } + switch (rec->which) + { + case Z_External_sutrs: + if (rec->u.octet_aligned->len > 170) + logf (LOG_LOG, "%d bytes:\n%.168s ...", + rec->u.sutrs->len, + rec->u.sutrs->buf); + else + logf (LOG_LOG, "%d bytes:\n%s", + rec->u.sutrs->len, + rec->u.sutrs->buf); + case Z_External_octet : + if (rec->u.octet_aligned->len > 170) + logf (LOG_LOG, "%d bytes:\n%.168s ...", + rec->u.octet_aligned->len, + rec->u.octet_aligned->buf); + else + logf (LOG_LOG, "%d bytes\n%s", + rec->u.octet_aligned->len, + rec->u.octet_aligned->buf); + } + } + } + } + } else { logf (LOG_WARN, "Unknown Extended Service(%d)", rr->esr->taskSpecificParameters->which); + } rr->errcode = 0; return 0; -- 1.7.10.4