-/* $Id: t16.c,v 1.2 2006-11-16 20:44:28 marc Exp $
- Copyright (C) 1995-2006
+/* $Id: t16.c,v 1.9 2007-01-15 15:10:20 adam Exp $
+ Copyright (C) 1995-2007
Index Data ApS
This file is part of the Zebra server.
static ZEBRA_RES fetch_first_compare(ZebraHandle zh, const char *element_set,
oid_value format, const char *cmp_rec)
{
- const char *rec_buf;
- size_t rec_len;
+ const char *rec_buf = 0;
+ size_t rec_len = 0;
ODR odr = odr_createmem(ODR_ENCODE);
ZEBRA_RES res = fetch_first(zh, element_set, format, odr,
&rec_buf, &rec_len);
zint hits;
ZEBRA_RES res;
const char * zebra_xml_sysno
- = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" set=\"zebra::meta::sysno\"/>\n";
+ = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\"/>\n";
+
+ const char * zebra_xml_meta
+ = "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" base=\"Default\" type=\"grs.sgml\" rank=\"0\" size=\"41\" set=\"zebra::meta\"/>\n";
const char * zebra_xml_index_title_p
= "<record xmlns=\"http://www.indexdata.com/zebra/\" sysno=\"2\" set=\"zebra::index::title:p/\">\n"
YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_TEXT_XML,
zebra_xml_sysno), ZEBRA_OK);
-
- /* YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data::index:title:p",
+
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta", VAL_TEXT_XML,
+ zebra_xml_meta), ZEBRA_OK);
+
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::title:p",
VAL_TEXT_XML,
zebra_xml_index_title_p), ZEBRA_OK);
- */
+
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::nonexistent",
+ VAL_TEXT_XML, ""), ZEBRA_OK);
+
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::nonexistent",
+ VAL_TEXT_XML, ""), ZEBRA_OK);
+
YAZ_CHECK(tl_close_down(zh, zs));
}