From a669063b8341659cd03dc90998997876b7177f4a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 29 Jun 2007 08:05:06 +0000 Subject: [PATCH] Added support for the use of the older versions or Extended Service Update in ZOOM. To faciliate this, an option "updateVersion" may be set to the version , 1=first, 2=second, 3=third. The third version is what ZOOM C has used so far. And that, obviously, is the default. --- NEWS | 5 +++++ doc/zoom.xml | 18 ++++++++++++++++-- src/zoom-c.c | 37 +++++++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 1784549..bfb31c1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Added support for the use of the older versions or Extended Service +Update in ZOOM. To faciliate this, an option "updateVersion" may be +set to the version , 1=first, 2=second, 3=third. The third version is +what ZOOM C has used so far. And that, obviously, is the default. + --- 3.0.8 2007/06/25 Fixed bug #1208: SSL appears to be broken in ZOOM. diff --git a/doc/zoom.xml b/doc/zoom.xml index 2075f34..19f5c37 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -20,7 +20,7 @@ ZOOM_options_set_int(opt, name, value) ZOOM_connection_scan1 (ZOOM_connection c, ZOOM_query startterm) ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) --> - + ZOOM &zoom; is an acronym for 'Z39.50 Object-Orientation Model' and is @@ -1145,7 +1145,7 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) recordDelete, elementUpdate. - specialUpdate + specialUpdate (recordInsert for updateVersion=1 which does not support specialUpdate) recordIdOpaque @@ -1189,6 +1189,20 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) Element Set for Record none + + updateVersion + Record Update version which holds one of the values + 1, 2 or 3. Each version has a distinct OID: + 1.2.840.10003.9.5 + (first version) , + 1.2.840.10003.9.5.1 + (second version) and + 1.2.840.10003.9.5.1.1 + (third and + newest version). + + 3 + diff --git a/src/zoom-c.c b/src/zoom-c.c index 41766a2..6f6e1ad 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.137 2007-06-25 18:34:27 adam Exp $ + * $Id: zoom-c.c,v 1.138 2007-06-29 08:05:07 adam Exp $ */ /** * \file zoom-c.c @@ -1341,7 +1341,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.137 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.138 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -3124,6 +3124,7 @@ static Z_APDU *create_update_package(ZOOM_package p) const char *recordIdNumber = ZOOM_options_get(p->options, "recordIdNumber"); const char *record_buf = ZOOM_options_get(p->options, "record"); const char *syntax_str = ZOOM_options_get(p->options, "syntax"); + const char *version = ZOOM_options_get(p->options, "updateVersion"); const char *correlationInfo_note = ZOOM_options_get(p->options, "correlationInfo.note"); @@ -3131,7 +3132,10 @@ static Z_APDU *create_update_package(ZOOM_package p) ZOOM_options_get(p->options, "correlationInfo.id"); int action_no = -1; Odr_oid *syntax_oid = 0; + const Odr_oid *package_oid = yaz_oid_extserv_database_update; + if (!version) + version = "3"; if (!syntax_str) syntax_str = "xml"; if (!record_buf) @@ -3152,8 +3156,27 @@ static Z_APDU *create_update_package(ZOOM_package p) if (num_db > 0) first_db = db[0]; - if (!action) - action = "specialUpdate"; + switch(*version) + { + case '1': + package_oid = yaz_oid_extserv_database_update_first_version; + /* old update does not support specialUpdate */ + if (!action) + action = "recordInsert"; + break; + case '2': + if (!action) + action = "specialUpdate"; + package_oid = yaz_oid_extserv_database_update_second_version; + break; + case '3': + if (!action) + action = "specialUpdate"; + package_oid = yaz_oid_extserv_database_update; + break; + default: + return 0; + } if (!strcmp(action, "recordInsert")) action_no = Z_IUOriginPartToKeep_recordInsert; @@ -3168,7 +3191,7 @@ static Z_APDU *create_update_package(ZOOM_package p) else return 0; - apdu = create_es_package(p, yaz_oid_extserv_database_update); + apdu = create_es_package(p, package_oid); if (apdu) { Z_IUOriginPartToKeep *toKeep; @@ -3179,10 +3202,8 @@ static Z_APDU *create_update_package(ZOOM_package p) ZOOM_options_get(p->options, "elementSetName"); apdu->u.extendedServicesRequest->taskSpecificParameters = r; - - r->direct_reference = odr_oiddup(p->odr_out, - yaz_oid_extserv_database_update); + r->direct_reference = odr_oiddup(p->odr_out, package_oid); r->descriptor = 0; r->which = Z_External_update; r->indirect_reference = 0; -- 1.7.10.4