X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Futil.cpp;h=4a3d4781fde7ba7c00b2c847f2da6ee2ba403535;hb=24c59a891cc78bd319b5db6c5ade450585e37ed1;hp=2f2fbc4525b0ab5e12c922f94906337e082c20b0;hpb=19386e546e57b3327ebe41f1634c91861678c620;p=metaproxy-moved-to-github.git diff --git a/src/util.cpp b/src/util.cpp index 2f2fbc4..4a3d478 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2012 Index Data + Copyright (C) 2005-2013 Index Data Metaproxy 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 @@ -163,6 +163,26 @@ std::string mp_util::database_name_normalize(const std::string &s) } +Z_RecordComposition *mp_util::piggyback_to_RecordComposition( + ODR odr, Odr_int result_set_size, Z_SearchRequest *sreq) +{ + Z_RecordComposition *comp = 0; + Odr_int present_dummy; + const char *element_set_name = 0; + mp::util::piggyback_sr(sreq, result_set_size, + present_dummy, &element_set_name); + if (element_set_name) + { + comp = (Z_RecordComposition *) odr_malloc(odr, sizeof(*comp)); + comp->which = Z_RecordComp_simple; + comp->u.simple = (Z_ElementSetNames *) + odr_malloc(odr, sizeof(Z_ElementSetNames)); + comp->u.simple->which = Z_ElementSetNames_generic; + comp->u.simple->u.generic = odr_strdup(odr, element_set_name); + } + return comp; +} + void mp_util::piggyback_sr(Z_SearchRequest *sreq, Odr_int result_set_size, Odr_int &number_to_present,