From fa96bc0dcc16f6ac3e33b5144664e51cb7d09874 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 16 Apr 2007 21:54:23 +0000 Subject: [PATCH] Another and hopefully, last, YAZ OID DB update --- include/yazpp/z-assoc.h | 14 ++++---------- include/yazpp/z-server.h | 4 ++-- src/yaz-ir-assoc.cpp | 19 ++++++++++++------- src/yaz-my-client.cpp | 12 ++++-------- src/yaz-my-server.cpp | 4 ++-- src/yaz-z-assoc.cpp | 20 ++++---------------- src/yaz-z-server.cpp | 16 ++++++---------- 7 files changed, 34 insertions(+), 55 deletions(-) diff --git a/include/yazpp/z-assoc.h b/include/yazpp/z-assoc.h index 158ad9f..805726c 100644 --- a/include/yazpp/z-assoc.h +++ b/include/yazpp/z-assoc.h @@ -2,7 +2,7 @@ * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: z-assoc.h,v 1.2 2007-04-12 15:00:33 adam Exp $ + * $Id: z-assoc.h,v 1.3 2007-04-16 21:54:23 adam Exp $ */ #ifndef YAZ_Z_ASSOC_INCLUDED @@ -64,19 +64,13 @@ class YAZ_EXPORT Z_Assoc : public IPDU_Observer { Z_OtherInformationUnit *update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, const int *oid, int categoryValue, int deleteFlag); + void set_otherInformationString( + Z_APDU *apdu, + const int *oid, int categoryValue, const char *str); void set_otherInformationString ( Z_OtherInformation **otherInformationP, const int *oid, int categoryValue, const char *str); - void set_otherInformationString ( - Z_OtherInformation **otherInformation, - const char *oidname, int categoryValue, - const char *str); - void set_otherInformationString ( - Z_APDU *apdu, - const char *oidval, int categoryValue, - const char *str); - Z_ReferenceId *getRefID(char* str); Z_ReferenceId **get_referenceIdP(Z_APDU *apdu); void transfer_referenceId(Z_APDU *from, Z_APDU *to); diff --git a/include/yazpp/z-server.h b/include/yazpp/z-server.h index 255b24f..a9c5434 100644 --- a/include/yazpp/z-server.h +++ b/include/yazpp/z-server.h @@ -2,7 +2,7 @@ * Copyright (c) 2000-2007, Index Data. * See the file LICENSE for details. * - * $Id: z-server.h,v 1.2 2007-04-12 15:00:33 adam Exp $ + * $Id: z-server.h,v 1.3 2007-04-16 21:54:23 adam Exp $ */ #include @@ -14,7 +14,7 @@ class Z_Server; class YAZ_EXPORT Z_ServerUtility { public: void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec, - const char *dbname, const char *format, + const char *dbname, const int *format, const void *buf, int len); void create_surrogateDiagnostics(ODR odr, Z_NamePlusRecord *rec, const char *dbname, int error, diff --git a/src/yaz-ir-assoc.cpp b/src/yaz-ir-assoc.cpp index 31689f4..e4491a7 100644 --- a/src/yaz-ir-assoc.cpp +++ b/src/yaz-ir-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-ir-assoc.cpp,v 1.28 2007-04-12 15:00:33 adam Exp $ + * $Id: yaz-ir-assoc.cpp,v 1.29 2007-04-16 21:54:23 adam Exp $ */ #include @@ -205,7 +205,8 @@ int IR_Assoc::send_searchRequest(Yaz_Z_Query *query, assert (req->otherInfo == 0); if (m_cookie) { - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); assert (req->otherInfo); } @@ -252,7 +253,7 @@ int IR_Assoc::send_presentRequest(int start, } if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, 1, m_cookie); if ( pRefId ) @@ -384,9 +385,11 @@ int IR_Assoc::send_initRequest(char* pRefId) } if (m_proxy && m_host) - set_otherInformationString(&req->otherInfo, OID_STR_PROXY, 1, m_host); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_proxy, + 1, m_host); if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); return send_Z_PDU(apdu, 0); } @@ -415,9 +418,11 @@ int IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId) } if (m_proxy && m_host) - set_otherInformationString(&req->otherInfo, OID_STR_PROXY, 1, m_host); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_proxy, + 1, m_host); if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); return send_Z_PDU(apdu, 0); } diff --git a/src/yaz-my-client.cpp b/src/yaz-my-client.cpp index e359be3..5fc292d 100644 --- a/src/yaz-my-client.cpp +++ b/src/yaz-my-client.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2007, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-client.cpp,v 1.27 2007-04-12 15:00:33 adam Exp $ + * $Id: yaz-my-client.cpp,v 1.28 2007-04-16 21:54:23 adam Exp $ */ #include @@ -113,14 +113,10 @@ void usage(char *prog) char *MyClient::get_cookie(Z_OtherInformation **otherInfo) { - Z_OtherInformationUnit *oi; + Z_OtherInformationUnit *oi = + update_otherInformation(otherInfo, 0, yaz_oid_userinfo_cookie, 1, 1); - const int *oid = - yaz_string_to_oid(yaz_oid_std(), CLASS_USERINFO, OID_STR_COOKIE); - - if (oid && - (oi = update_otherInformation(otherInfo, 0, oid, 1, 1)) && - oi->which == Z_OtherInfo_characterInfo) + if (oi->which == Z_OtherInfo_characterInfo) return oi->information.characterInfo; return 0; } diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index 70e9fb4..9d6acfc 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-server.cpp,v 1.21 2007-04-12 15:00:33 adam Exp $ + * $Id: yaz-my-server.cpp,v 1.22 2007-04-16 21:54:23 adam Exp $ */ #include @@ -133,7 +133,7 @@ void MyRetrieval::sr_record (const char *resultSetName, const char *rec = get_record(position); if (rec) create_databaseRecord(odr_encode(), namePlusRecord, 0, - OID_STR_USMARC, rec, strlen(rec)); + yaz_oid_recsyn_usmarc, rec, strlen(rec)); else create_surrogateDiagnostics(odr_encode(), namePlusRecord, 0, YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, 0); diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index 3bd680b..f97838a 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2007, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-assoc.cpp,v 1.41 2007-04-12 15:00:33 adam Exp $ + * $Id: yaz-z-assoc.cpp,v 1.42 2007-04-16 21:54:23 adam Exp $ */ #include @@ -374,30 +374,18 @@ void Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) } } -void Z_Assoc::set_otherInformationString ( +void Z_Assoc::set_otherInformationString( Z_APDU *apdu, - const char *oidname, int categoryValue, - const char *str) + const int *oid, int categoryValue, const char *str) { Z_OtherInformation **otherInformation; get_otherInfoAPDU(apdu, &otherInformation); if (!otherInformation) return; - set_otherInformationString(otherInformation, oidname, categoryValue, str); -} - -void Z_Assoc::set_otherInformationString ( - Z_OtherInformation **otherInformation, - const char *oidname, int categoryValue, - const char *str) -{ - int *oid = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_USERINFO, oidname, - odr_encode()); - if (!oid) - return ; set_otherInformationString(otherInformation, oid, categoryValue, str); } + void Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, const int *oid, int categoryValue, const char *str) diff --git a/src/yaz-z-server.cpp b/src/yaz-z-server.cpp index efe0ed4..5ad11c6 100644 --- a/src/yaz-z-server.cpp +++ b/src/yaz-z-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server.cpp,v 1.25 2007-04-12 15:00:33 adam Exp $ + * $Id: yaz-z-server.cpp,v 1.26 2007-04-16 21:54:23 adam Exp $ */ #include @@ -113,11 +113,10 @@ void Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len) * database record. */ void Z_ServerUtility::create_databaseRecord ( - ODR odr, Z_NamePlusRecord *rec, const char *dbname, const char *format, + ODR odr, Z_NamePlusRecord *rec, const char *dbname, const int *format, const void *buf, int len) { - int *oid = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, format, - odr); + int *oid = odr_oiddup(odr, format); rec->databaseName = dbname ? odr_strdup (odr, dbname) : 0; rec->which = Z_NamePlusRecord_databaseRecord; rec->u.databaseRecord = z_ext_record_oid(odr, oid, @@ -143,8 +142,7 @@ void Z_ServerUtility::create_surrogateDiagnostics( rec->u.surrogateDiagnostic = drec; drec->which = Z_DiagRec_defaultFormat; drec->u.defaultFormat = dr; - dr->diagnosticSetId = - yaz_string_to_oid_odr(yaz_oid_std(), CLASS_DIAGSET, OID_STR_BIB1, odr); + dr->diagnosticSetId = odr_oiddup(odr, yaz_oid_diagset_bib_1); dr->condition = err; dr->which = Z_DefaultDiagFormat_v2Addinfo; @@ -166,8 +164,7 @@ Z_Records *Z_ServerUtility::create_nonSurrogateDiagnostics ( *err = error; rec->which = Z_Records_NSD; rec->u.nonSurrogateDiagnostic = dr; - dr->diagnosticSetId = - yaz_string_to_oid_odr(yaz_oid_std(), CLASS_DIAGSET, OID_STR_BIB1, odr); + dr->diagnosticSetId = odr_oiddup(odr, yaz_oid_diagset_bib_1); dr->condition = err; dr->which = Z_DefaultDiagFormat_v2Addinfo; @@ -189,8 +186,7 @@ void Z_ServerUtility::create_diagnostics ( drec->which = Z_DiagRec_defaultFormat; drec->u.defaultFormat = dr; - dr->diagnosticSetId = - yaz_string_to_oid_odr(yaz_oid_std(), CLASS_DIAGSET, OID_STR_BIB1, odr); + dr->diagnosticSetId = odr_oiddup(odr, yaz_oid_diagset_bib_1); dr->condition = odr_intdup (odr, error); dr->which = Z_DefaultDiagFormat_v2Addinfo; dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : ""); -- 1.7.10.4