X-Git-Url: http://git.indexdata.com/?p=yazproxy-moved-to-github.git;a=blobdiff_plain;f=src%2Fyaz-proxy.cpp;h=35c5ba22ab2360dc95431f14107501e8049ec529;hp=e2009788519421a847c4b442111aaf49b2c81ad9;hb=7b429cd9f6320f71b949f7e90270266b2f617c07;hpb=5e44f9e8b9c90d13e59169f966bec3593047f603 diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index e200978..35c5ba2 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -1,5 +1,5 @@ /* This file is part of YAZ proxy - Copyright (C) 1998-2008 Index Data + Copyright (C) 1998-2009 Index Data YAZ proxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -51,6 +51,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include "msg-thread.h" +#if YAZ_VERSIONL >= 0x03001D +#define YAZ_HAS_MK_SURROGATE 1 +#else +#define YAZ_HAS_MK_SURROGATE 0 +#endif + using namespace yazpp_1; #ifdef WIN32 @@ -1231,8 +1237,10 @@ int Yaz_Proxy::z_to_srw_diag(ODR o, Z_SRW_searchRetrieveResponse *srw_res, return 0; } -static void yazproxy_encode_sru_surrogate(ODR o, Z_SRW_record *record, int pos, - int code, const char *details) +#if YAZ_HAS_MK_SURROGATE +#else +static void yazproxy_mk_sru_surrogate(ODR o, Z_SRW_record *record, int pos, + int code, const char *details) { const char *message = yaz_diag_srw_str(code); int len = 200; @@ -1258,7 +1266,7 @@ static void yazproxy_encode_sru_surrogate(ODR o, Z_SRW_record *record, int pos, record->recordPosition = odr_intdup(o, pos); record->recordSchema = odr_strdup(o, "info:srw/schema/1/diagnostics-v1.1"); } - +#endif int Yaz_Proxy::send_to_srw_client_ok(int hits, Z_Records *records, int start) { @@ -1279,10 +1287,15 @@ int Yaz_Proxy::send_to_srw_client_ok(int hits, Z_Records *records, int start) Z_NamePlusRecord *npr = records->u.databaseOrSurDiagnostics->records[i]; if (npr->which != Z_NamePlusRecord_databaseRecord) { - yaz_log(YLOG_LOG, "Point 1"); - yazproxy_encode_sru_surrogate( +#if YAZ_HAS_MK_SURROGATE + yaz_mk_sru_surrogate( + o, srw_res->records + i, i+start, + YAZ_SRW_RECORD_NOT_AVAILABLE_IN_THIS_SCHEMA, 0); +#else + yazproxy_mk_sru_surrogate( o, srw_res->records + i, i+start, YAZ_SRW_RECORD_NOT_AVAILABLE_IN_THIS_SCHEMA, 0); +#endif continue; } Z_External *r = npr->u.databaseRecord; @@ -1299,10 +1312,15 @@ int Yaz_Proxy::send_to_srw_client_ok(int hits, Z_Records *records, int start) } else { - yaz_log(YLOG_LOG, "Point 2"); - yazproxy_encode_sru_surrogate( +#if YAZ_HAS_MK_SURROGATE + yaz_mk_sru_surrogate( o, srw_res->records + i, i+start, YAZ_SRW_RECORD_NOT_AVAILABLE_IN_THIS_SCHEMA, 0); +#else + yazproxy_mk_sru_surrogate( + o, srw_res->records + i, i+start, + YAZ_SRW_RECORD_NOT_AVAILABLE_IN_THIS_SCHEMA, 0); +#endif } } }