-/* $Id: d1_absyn.c,v 1.34 2007-01-22 18:15:02 adam Exp $
+/* $Id: d1_absyn.c,v 1.35 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <string.h>
#include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
#include <idzebra/data1.h>
#include <idzebra/recctrl.h>
#include <zebra_xpath.h>
return 0;
}
-data1_attset *data1_attset_search_id (data1_handle dh, int id)
+data1_attset *data1_attset_search_id(data1_handle dh, const int *oid)
{
data1_attset_cache p = *data1_attset_cache_get (dh);
while (p)
{
- if (id == p->attset->reference)
+ if (p->attset->oid && !oid_oidcmp(oid, p->attset->oid))
return p->attset;
p = p->next;
}
res = (data1_absyn *) nmem_malloc(data1_nmem_get(dh), sizeof(*res));
res->name = 0;
- res->reference = VAL_NONE;
+ res->oid = 0;
res->tagset = 0;
res->encoding = 0;
res->xpath_indexing =
continue;
}
name = argv[1];
- if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_SCHEMA, name,
+ data1_nmem_get(dh));
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
file, lineno, name);
-/* $Id: d1_attset.c,v 1.13 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_attset.c,v 1.14 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <stdlib.h>
#include <yaz/log.h>
+#include <yaz/oid_db.h>
#include <idzebra/data1.h>
data1_att *data1_getattbyname(data1_handle dh, data1_attset *s, const char *name)
data1_attset *res = (data1_attset*) nmem_malloc(mem,sizeof(*res));
res->name = 0;
- res->reference = VAL_NONE;
+ res->oid = 0;
res->atts = 0;
res->children = 0;
res->next = 0;
continue;
}
name = argv[1];
- if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_ATTSET, name, mem);
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown reference oid '%s'",
file, lineno, name);
-/* $Id: d1_doespec.c,v 1.12 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_doespec.c,v 1.13 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
*/
+/** \file d1_doespec.c
+ * \brief handle Z39.50 variant-1 specs
+ *
+ * See http://www.loc.gov/z3950/agency/defns/variant1.html
+ */
#include <assert.h>
#include <stdlib.h>
#include <yaz/log.h>
-#include <yaz/oid.h>
#include <yaz/proto.h>
+#include <yaz/oid_db.h>
#include <idzebra/data1.h>
static int match_children(data1_handle dh, data1_node *n,
* set is the set to look for, universal set is the set that applies to a
* triple with an unknown set.
*/
-static Z_Triple *find_triple(Z_Variant *var, oid_value universalset,
- oid_value set, int zclass, int type)
+static Z_Triple *find_triple(Z_Variant *var, const int *universal_oid,
+ const int *var_oid, int zclass, int type)
{
int i;
- oident *defaultsetent = oid_getentbyoid(var->globalVariantSetId);
- oid_value defaultset = defaultsetent ? defaultsetent->value :
- universalset;
for (i = 0; i < var->num_triples; i++)
{
- oident *cursetent =
- oid_getentbyoid(var->triples[i]->variantSetId);
- oid_value curset = cursetent ? cursetent->value : defaultset;
-
- if (set == curset &&
- *var->triples[i]->zclass == zclass &&
- *var->triples[i]->type == type)
+ const int *cur_oid = var->triples[i]->variantSetId;
+ if (!cur_oid)
+ cur_oid = var->globalVariantSetId;
+ if (cur_oid && var_oid
+ && !oid_oidcmp(var_oid, cur_oid) && *var->triples[i]->type == type)
return var->triples[i];
}
return 0;
}
-static void match_triple (data1_handle dh, Z_Variant *vreq,
- oid_value defsetval,
- oid_value var1, data1_node *n)
+static void match_triple(data1_handle dh, Z_Variant *vreq,
+ const int *def_oid,
+ const int *var_oid, data1_node *n)
{
data1_node **c;
if ((*c)->u.variant.type->zclass->zclass == 4 &&
(*c)->u.variant.type->type == 1)
{
- if ((r = find_triple(vreq, defsetval, var1, 4, 1)) &&
+ if ((r = find_triple(vreq, def_oid, var_oid, 4, 1)) &&
(r->which == Z_Triple_internationalString))
{
const char *string_value =
}
else
{
- match_triple (dh, vreq, defsetval, var1, *c);
+ match_triple(dh, vreq, def_oid, var_oid, *c);
c = &(*c)->next;
}
}
Z_Variant *vreq =
e->elements[i]->u.simpleElement->variantRequest;
- oident *defset = oid_getentbyoid(e->defaultVariantSetId);
- oid_value defsetval = defset ? defset->value : VAL_NONE;
- oid_value var1 = oid_getvalbyname("Variant-1");
+ const int *var_oid = yaz_oid_variant1();
if (!vreq)
vreq = e->defaultVariantRequest;
/*
* 6,5: meta-data requested, variant list.
*/
- if (find_triple(vreq, defsetval, var1, 6, 5))
+ if (find_triple(vreq, e->defaultVariantSetId,
+ var_oid, 6, 5))
show_variantlist = 1;
/*
* 9,1: Miscellaneous, no data requested.
*/
- if (find_triple(vreq, defsetval, var1, 9, 1))
+ if (find_triple(vreq, e->defaultVariantSetId,
+ var_oid, 9, 1))
no_data = 1;
/* howmuch */
- if ((r = find_triple(vreq, defsetval, var1, 5, 5)))
+ if ((r = find_triple(vreq, e->defaultVariantSetId,
+ var_oid, 5, 5)))
if (r->which == Z_Triple_integer)
get_bytes = *r->value.integer;
if (!show_variantlist)
- match_triple (dh, vreq, defsetval, var1, c);
+ match_triple(dh, vreq, e->defaultVariantSetId,
+ var_oid, c);
}
mark_subtree(c, show_variantlist, no_data, get_bytes, vreq,
select_flag);
-/* $Id: d1_espec.c,v 1.13 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_espec.c,v 1.14 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/odr.h>
#include <yaz/proto.h>
#include <idzebra/data1.h>
+#include <yaz/oid_db.h>
static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
const char *file, int lineno)
{
Z_Variant *r = (Z_Variant *)nmem_malloc(nmem, sizeof(*r));
- oident var1;
int i;
- int oid[OID_SIZE];
-
- var1.proto = PROTO_Z3950;
- var1.oclass = CLASS_VARSET;
- var1.value = VAL_VAR1;
- r->globalVariantSetId = odr_oiddup_nmem(nmem, oid_ent_to_oid(&var1, oid));
+ r->globalVariantSetId = odr_oiddup_nmem(nmem, yaz_oid_variant1());
if (argc)
r->triples = (Z_Triple **)nmem_malloc(nmem, sizeof(Z_Triple*) * argc);
else
-/* $Id: d1_expout.c,v 1.9 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_expout.c,v 1.10 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/log.h>
#include <yaz/proto.h>
+#include <yaz/oid_db.h>
+#include <yaz/snprintf.h>
#include <idzebra/data1.h>
typedef struct {
static Odr_oid *f_oid(ExpHandle *eh, data1_node *c, oid_class oclass)
{
char oidstr[64];
- int oid_this[20];
- oid_value value_for_this;
c = c->child;
if (!is_data_tag (eh, c) || c->u.data.len > 63)
return 0;
- sprintf(oidstr, "%.*s", c->u.data.len, c->u.data.data);
- value_for_this = oid_getvalbyname(oidstr);
- if (value_for_this == VAL_NONE)
- {
- Odr_oid *oid = odr_getoidbystr(eh->o, oidstr);
- assert (oid);
- return oid;
- }
- else
- {
- struct oident ident;
+ yaz_snprintf(oidstr, sizeof(oidstr)-1,
+ "%.*s", c->u.data.len, c->u.data.data);
- ident.oclass = oclass;
- ident.proto = PROTO_Z3950;
- ident.value = value_for_this;
-
- oid_ent_to_oid (&ident, oid_this);
- }
- return odr_oiddup (eh->o, oid_this);
+ return yaz_string_to_oid_odr(yaz_oid_std(),
+ CLASS_GENERAL, oidstr, eh->o);
}
static Z_IntUnit *f_intunit(ExpHandle *eh, data1_node *c)
-/* $Id: d1_map.c,v 1.15 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_map.c,v 1.16 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <string.h>
#include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
#include <yaz/readconf.h>
#include <yaz/tpath.h>
#include <d1_absyn.h>
return 0;
res->name = 0;
- res->target_absyn_ref = VAL_NONE;
+ res->oid = 0;
res->map = 0;
mapp = &res->map;
res->next = 0;
file, lineno);
continue;
}
- if ((res->target_absyn_ref = oid_getvalbyname(argv[1]))
- == VAL_NONE)
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_RECSYN, argv[1], mem);
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
file, lineno, argv[1]);
-/* $Id: d1_marc.c,v 1.17 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_marc.c,v 1.18 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <string.h>
#include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
#include <yaz/marcdisp.h>
#include <yaz/readconf.h>
#include <yaz/xmalloc.h>
return 0;
res->name = 0;
- res->reference = VAL_NONE;
+ res->oid = 0;
res->next = 0;
res->length_data_entry = 4;
res->length_starting = 5;
*argv);
continue;
}
- if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_TAGSET, argv[1],
+ mem);
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown tagset reference '%s'",
file, lineno, argv[1]);
-/* $Id: d1_read.c,v 1.24 2007-03-20 22:07:35 adam Exp $
+/* $Id: d1_read.c,v 1.25 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
{
data1_absyn *absyn = data1_get_absyn(dh, name, 1);
data1_node *res;
+
if (!absyn)
{
yaz_log(YLOG_WARN, "Unable to acquire abstract syntax " "for '%s'",
-/* $Id: d1_tagset.c,v 1.9 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_tagset.c,v 1.10 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/log.h>
#include <idzebra/data1.h>
+#include <yaz/oid_db.h>
/*
* We'll probably want to add some sort of hashed index to these lookup-
data1_tagset *res =
(data1_tagset *) nmem_malloc(data1_nmem_get (dh), sizeof(*res));
res->name = 0;
- res->reference = VAL_NONE;
+ res->oid = 0;
res->tags = 0;
res->type = 0;
res->children = 0;
continue;
}
name = argv[1];
- if ((res->reference = oid_getvalbyname(name)) == VAL_NONE)
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_TAGSET, name, mem);
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown tagset ref '%s'",
file, lineno, name);
-/* $Id: d1_varset.c,v 1.10 2007-01-15 15:10:14 adam Exp $
+/* $Id: d1_varset.c,v 1.11 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <string.h>
#include <stdlib.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
#include <yaz/log.h>
#include <d1_absyn.h>
char *argv[50],line[512];
res->name = 0;
- res->reference = VAL_NONE;
+ res->oid = 0;
res->classes = 0;
if (!(f = data1_path_fopen(dh, file, "r")))
file, lineno);
continue;
}
- if ((res->reference = oid_getvalbyname(argv[1])) == VAL_NONE)
+ res->oid = yaz_string_to_oid_nmem(yaz_oid_std(),
+ CLASS_VARSET, argv[1], mem);
+ if (!res->oid)
{
yaz_log(YLOG_WARN, "%s:%d: Unknown reference '%s'",
file, lineno, argv[1]);
-/* $Id: attrfind.h,v 1.3 2007-01-15 20:08:24 adam Exp $
+/* $Id: attrfind.h,v 1.4 2007-04-16 08:44:31 adam Exp $
Copyright (C) 2005-2007
Index Data ApS
#include <yaz/yconfig.h>
#include <yaz/z-core.h>
-#include <yaz/oid.h>
YAZ_BEGIN_CDECL
void attr_init_AttrList(AttrType *src, Z_AttributeList *list, int type);
-int attr_find_ex(AttrType *src, oid_value *attributeSetP,
+int attr_find_ex(AttrType *src, const int **attribute_set_oid,
const char **string_value);
-int attr_find(AttrType *src, oid_value *attributeSetP);
-
+int attr_find(AttrType *src, const int **attribute_set_oid);
YAZ_END_CDECL
-/* $Id: d1_absyn.h,v 1.11 2007-01-22 18:15:03 adam Exp $
+/* $Id: d1_absyn.h,v 1.12 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
struct data1_absyn
{
char *name;
- oid_value reference;
+ int *oid;
data1_tagset *tagset;
data1_varset *varset;
data1_esetname *esetnames;
-/* $Id: api.h,v 1.47 2007-03-14 11:48:31 adam Exp $
+/* $Id: api.h,v 1.48 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#define IDZEBRA_API_H
#include <yaz/odr.h>
-#include <yaz/oid.h>
#include <yaz/proto.h>
#include <idzebra/res.h>
#include <idzebra/version.h>
int position; /* position of record in result set (1,2,..) */
char *buf; /* record buffer (void pointer really) */
int len; /* length */
- oid_value format; /* record syntax */
+ const int *format; /* record syntax */
char *base;
zint sysno;
int score;
ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
const char *setname,
Z_RecordComposition *comp,
- oid_value input_format,
+ const int *input_format,
int num_recs,
ZebraRetrievalRecord *recs);
/** \brief Deletes one or more resultsets
*/
YAZ_EXPORT ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream,
Z_AttributesPlusTerm *zapt,
- oid_value attributeset,
+ const int *attributeset,
int *position, int *num_entries,
ZebraScanEntry **entries,
int *is_partial,
-/* $Id: data1.h,v 1.21 2007-01-15 20:08:24 adam Exp $
+/* $Id: data1.h,v 1.22 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <stdio.h>
#include <yaz/nmem.h>
-#include <yaz/oid.h>
#include <yaz/proto.h>
#include <yaz/yaz-util.h>
struct data1_attset
{
char *name; /* symbolic name */
- oid_value reference; /* external ID of attset */
+ int *oid; /* attribute set OID */
data1_att *atts; /* attributes */
data1_attset_child *children; /* included attset */
data1_attset *next; /* next in cache */
typedef struct data1_maptab
{
char *name;
- oid_value target_absyn_ref;
+ int *oid; /* target abstract syntax */
char *target_absyn_name;
data1_mapunit *map;
struct data1_maptab *next;
typedef struct data1_marctab
{
char *name;
- oid_value reference;
+ int *oid; /* MARC OID */
char record_status[2];
char implementation_codes[5];
typedef struct data1_varset
{
char *name;
- oid_value reference;
+ int *oid; /* variant OID */
data1_varclass *classes;
} data1_varset;
{
int type; /* type of tagset in current context */
char *name; /* symbolic name */
- oid_value reference;
+ int *oid; /* variant OID */
data1_tag *tags; /* tags defined by this set */
data1_tagset *children; /* children */
data1_tagset *next; /* sibling */
void (*fh)(data1_handle dh,
void *h, data1_absyn *a));
-YAZ_EXPORT data1_attset *data1_attset_search_id (data1_handle dh, int id);
+YAZ_EXPORT data1_attset *data1_attset_search_id (data1_handle dh,
+ const int *oid);
YAZ_EXPORT char *data1_getNodeValue(data1_node* node, char* pTagPath);
YAZ_EXPORT data1_node *data1_LookupNode(data1_node* node, char* pTagPath);
-/* $Id: recctrl.h,v 1.33 2007-03-14 14:16:14 adam Exp $
+/* $Id: recctrl.h,v 1.34 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <sys/types.h>
#include <yaz/proto.h>
-#include <yaz/oid.h>
#include <yaz/odr.h>
#include <idzebra/res.h>
#include <idzebra/data1.h>
/* Input parameters ... */
Res res; /* Resource pool */
ODR odr; /* ODR used to create response */
- oid_value input_format; /* Preferred record syntax */
+ const int*input_format; /* Preferred record syntax OID */
Z_RecordComposition *comp; /* formatting instructions */
char *encoding; /* preferred character encoding */
zint localno; /* local id of record */
zebra_snippets *doc_snippet;
/* response */
- oid_value output_format;
- void *rec_buf;
+ const int *output_format; /* output format OID */
+ void * rec_buf;
int rec_len;
int diagnostic;
- char *addinfo;
+ char * addinfo;
};
typedef struct recType *RecType;
-/* $Id: alvis.c,v 1.15 2007-03-19 21:50:39 adam Exp $
+/* $Id: alvis.c,v 1.16 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/diagbib1.h>
#include <yaz/tpath.h>
+#include <yaz/oid_db.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
{
p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
}
- else if (p->input_format == VAL_NONE || p->input_format == VAL_TEXT_XML)
+ else if (!p->input_format || !oid_oidcmp(p->input_format, yaz_oid_xml()))
{
xmlChar *buf_out;
int len_out;
else
xmlDocDumpMemory(resDoc, &buf_out, &len_out);
- p->output_format = VAL_TEXT_XML;
+ p->output_format = yaz_oid_xml();
p->rec_len = len_out;
p->rec_buf = odr_malloc(p->odr, p->rec_len);
memcpy(p->rec_buf, buf_out, p->rec_len);
xmlFree(buf_out);
}
- else if (p->output_format == VAL_SUTRS)
+ else if (!oid_oidcmp(p->output_format, yaz_oid_sutrs()))
{
xmlChar *buf_out;
int len_out;
else
xmlDocDumpMemory(resDoc, &buf_out, &len_out);
- p->output_format = VAL_SUTRS;
+ p->output_format = yaz_oid_sutrs();
p->rec_len = len_out;
p->rec_buf = odr_malloc(p->odr, p->rec_len);
memcpy(p->rec_buf, buf_out, p->rec_len);
-/* $Id: attribute.c,v 1.28 2007-01-15 15:10:16 adam Exp $
+/* $Id: attribute.c,v 1.29 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <idzebra/util.h>
#include <attrfind.h>
#include "index.h"
+#include <yaz/oid_db.h>
static data1_att *getatt(data1_attset *p, int att)
{
return 0;
}
-static int att_getentbyatt(ZebraHandle zi, oid_value set, int att,
+static int att_getentbyatt(ZebraHandle zi, const int *set, int att,
const char **name)
{
data1_att *r;
Z_AttributeList *attr_list,
zinfo_index_category_t cat,
int index_type,
- oid_value curAttributeSet,
+ const int *curAttributeSet,
int *ord)
{
int use_value = -1;
Z_AttributesPlusTerm *zapt,
int index_type,
const char *xpath_use,
- oid_value curAttributeSet,
+ const int *curAttributeSet,
int *ord)
{
ZEBRA_RES res = ZEBRA_OK;
{
AttrType structure;
int structure_value;
+
attr_init_AttrList(&structure, sortAttributes->list, 4);
*numerical = 0;
structure_value = attr_find(&structure, 0);
if (structure_value == 109)
*numerical = 1;
-
- if (zebra_attr_list_get_ord(zh, sortAttributes->list,
- zinfo_index_category_sort,
- -1 /* any index */, VAL_BIB1, ord)== ZEBRA_OK)
+
+ if (zebra_attr_list_get_ord(
+ zh, sortAttributes->list,
+ zinfo_index_category_sort,
+ -1 /* any index */, yaz_oid_attset_bib1(), ord) == ZEBRA_OK)
return ZEBRA_OK;
return ZEBRA_FAIL;
}
-/* $Id: index.h,v 1.196 2007-03-14 11:48:32 adam Exp $
+/* $Id: index.h,v 1.197 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
struct rset_key_control *zebra_key_control_create(ZebraHandle zh);
ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream, NMEM rset_nmem,
Z_SortKeySpecList *sort_sequence,
int num_bases, char **basenames,
zint *approx_limit);
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
- oid_value attributeset,
+ const int *attributeset,
int num_bases, char **basenames,
int *position, int *num_entries, ZebraScanEntry **list,
int *is_partial, RSET limit_set);
void resultSetInvalidate(ZebraHandle zh);
int zebra_record_fetch(ZebraHandle zh, zint sysno, int score,
- zebra_snippets *hit_snippet, ODR stream,
- oid_value input_format, Z_RecordComposition *comp,
- oid_value *output_format, char **rec_bufp,
- int *rec_lenp, char **basenamep,
- char **addinfo);
+ zebra_snippets *hit_snippet, ODR stream,
+ const int *input_format, Z_RecordComposition *comp,
+ const int **output_format, char **rec_bufp,
+ int *rec_lenp, char **basenamep,
+ char **addinfo);
void extract_get_fname_tmp(ZebraHandle zh, char *fname, int no);
Z_AttributesPlusTerm *zapt,
int index_type,
const char *xpath_use,
- oid_value curAttributeSet,
+ const int *curAttributeSet,
int *ord);
ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
Z_AttributeList *attr_list,
zinfo_index_category_t cat,
int index_type,
- oid_value curAttributeSet,
+ const int *curAttributeSet,
int *ord);
ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh,
-/* $Id: mod_dom.c,v 1.34 2007-04-07 22:18:46 adam Exp $
+/* $Id: mod_dom.c,v 1.35 2007-04-16 08:44:31 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <idzebra/util.h>
#include <idzebra/recctrl.h>
+#include <yaz/oid_db.h>
/* DOM filter style indexing */
#define ZEBRA_DOM_NS "http://indexdata.com/zebra-2.0"
{
p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
}
- else if (p->input_format == VAL_NONE || p->input_format == VAL_TEXT_XML)
+ else if (!p->input_format || !oid_oidcmp(p->input_format, yaz_oid_xml()))
{
xmlChar *buf_out;
int len_out;
else
xmlDocDumpMemory(doc, &buf_out, &len_out);
- p->output_format = VAL_TEXT_XML;
+ p->output_format = yaz_oid_xml();
p->rec_len = len_out;
p->rec_buf = odr_malloc(p->odr, p->rec_len);
memcpy(p->rec_buf, buf_out, p->rec_len);
xmlFree(buf_out);
}
- else if (p->output_format == VAL_SUTRS)
+ else if (!oid_oidcmp(p->output_format, yaz_oid_sutrs()))
{
xmlChar *buf_out;
int len_out;
else
xmlDocDumpMemory(doc, &buf_out, &len_out);
- p->output_format = VAL_SUTRS;
+ p->output_format = yaz_oid_sutrs();
p->rec_len = len_out;
p->rec_buf = odr_malloc(p->odr, p->rec_len);
memcpy(p->rec_buf, buf_out, p->rec_len);
-/* $Id: recgrs.c,v 1.16 2007-03-07 21:08:36 adam Exp $
+/* $Id: recgrs.c,v 1.17 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <ctype.h>
#include <yaz/log.h>
-#include <yaz/oid.h>
+#include <yaz/oid_db.h>
#include <yaz/diagbib1.h>
#include <d1_absyn.h>
int grs_extract_tree(struct recExtractCtrl *p, data1_node *n)
{
- oident oe;
- int oidtmp[OID_SIZE];
RecWord wrd;
- oe.proto = PROTO_Z3950;
- oe.oclass = CLASS_SCHEMA;
- if (n->u.root.absyn)
- {
- oe.value = n->u.root.absyn->reference;
-
- if ((oid_ent_to_oid (&oe, oidtmp)))
- (*p->schemaAdd)(p, oidtmp);
- }
+ if (n->u.root.absyn && n->u.root.absyn->oid)
+ (*p->schemaAdd)(p, n->u.root.absyn->oid);
(*p->init)(p, &wrd);
/* data1_pr_tree(p->dh, n, stdout); */
{
data1_node *n;
struct grs_read_info gri;
- oident oe;
- int oidtmp[OID_SIZE];
RecWord wrd;
gri.stream = p->stream;
n = (*grs_read)(&gri);
if (!n)
return RECCTRL_EXTRACT_EOF;
- oe.proto = PROTO_Z3950;
- oe.oclass = CLASS_SCHEMA;
-#if 0
- if (!n->u.root.absyn)
- return RECCTRL_EXTRACT_ERROR;
-#endif
- if (n->u.root.absyn)
- {
- oe.value = n->u.root.absyn->reference;
- if ((oid_ent_to_oid (&oe, oidtmp)))
- (*p->schemaAdd)(p, oidtmp);
- }
+ if (n->u.root.absyn && n->u.root.absyn->oid)
+ (*p->schemaAdd)(p, n->u.root.absyn->oid);
data1_concat_text(p->dh, mem, n);
/* ensure our data1 tree is UTF-8 */
NMEM mem;
struct grs_read_info gri;
const char *tagname;
+ const int *xml_oid = yaz_oid_xml();
+ const int *grs1_oid = yaz_oid_grs1();
- int requested_schema = VAL_NONE;
+ const int *requested_schema = 0;
data1_marctab *marctab;
int dummy;
dnew->u.data.len = strlen(dnew->u.data.data);
}
- if (p->input_format == VAL_TEXT_XML)
- zebra_xml_metadata (p, top, mem);
+ if (!p->input_format)
+ { /* SUTRS is default input_format */
+ p->input_format = yaz_oid_sutrs();
+ }
+ assert(p->input_format);
+
+ if (!oid_oidcmp(p->input_format, xml_oid))
+ zebra_xml_metadata (p, top, mem);
#if 0
data1_pr_tree (p->dh, node, stdout);
p->comp->u.complex->generic->which == Z_Schema_oid &&
p->comp->u.complex->generic->schema.oid)
{
- oident *oe = oid_getentbyoid (p->comp->u.complex->generic->schema.oid);
- if (oe)
- requested_schema = oe->value;
+ requested_schema = p->comp->u.complex->generic->schema.oid;
}
/* If schema has been specified, map if possible, then check that
* we got the right one
*/
- if (requested_schema != VAL_NONE)
+ if (requested_schema)
{
yaz_log(YLOG_DEBUG, "grs_retrieve: schema mapping");
for (map = node->u.root.absyn->maptabs; map; map = map->next)
{
- if (map->target_absyn_ref == requested_schema)
+ // if (map->target_absyn_ref == requested_schema)
+ if (!oid_oidcmp(map->oid, requested_schema))
{
onode = node;
if (!(node = data1_map_record(p->dh, onode, map, mem)))
break;
}
}
- if (node->u.root.absyn &&
- requested_schema != node->u.root.absyn->reference)
+ if (node->u.root.absyn
+ && oid_oidcmp(requested_schema, node->u.root.absyn->oid))
{
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
nmem_destroy (mem);
return 0;
}
if (node->u.root.absyn)
for (map = node->u.root.absyn->maptabs; map; map = map->next)
{
- if (map->target_absyn_ref == p->input_format)
+ if (!oid_oidcmp(map->oid, p->input_format))
{
onode = node;
if (!(node = data1_map_record(p->dh, onode, map, mem)))
}
}
yaz_log(YLOG_DEBUG, "grs_retrieve: schemaIdentifier");
- if (node->u.root.absyn &&
- node->u.root.absyn->reference != VAL_NONE &&
- p->input_format == VAL_GRS1)
+ if (node->u.root.absyn && node->u.root.absyn->oid
+ && !oid_oidcmp(p->input_format, grs1_oid))
{
- oident oe;
- Odr_oid *oid;
- int oidtmp[OID_SIZE];
-
- oe.proto = PROTO_Z3950;
- oe.oclass = CLASS_SCHEMA;
- oe.value = node->u.root.absyn->reference;
-
- if ((oid = oid_ent_to_oid (&oe, oidtmp)))
- {
- char tmp[128];
- data1_handle dh = p->dh;
- char *p = tmp;
- int *ii;
-
- for (ii = oid; *ii >= 0; ii++)
- {
- if (p != tmp)
- *(p++) = '.';
- sprintf(p, "%d", *ii);
- p += strlen(p);
- }
- if ((dnew = data1_mk_tag_data_wd(dh, top,
- "schemaIdentifier", mem)))
- {
- dnew->u.data.what = DATA1I_oid;
- dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
- memcpy(dnew->u.data.data, tmp, p - tmp);
- dnew->u.data.len = p - tmp;
- }
+ char oid_str[OID_STR_MAX];
+ char *dot_str = oid_oid_to_dotstring(node->u.root.absyn->oid, oid_str);
+
+ if (dot_str && (dnew = data1_mk_tag_data_wd(p->dh, top,
+ "schemaIdentifier", mem)))
+ {
+ dnew->u.data.what = DATA1I_oid;
+ dnew->u.data.data = (char *) nmem_strdup(mem, dot_str);
+ dnew->u.data.len = strlen(dot_str);
}
}
data1_pr_tree (p->dh, node, stdout);
#endif
yaz_log(YLOG_DEBUG, "grs_retrieve: transfer syntax mapping");
- switch (p->output_format = (p->input_format != VAL_NONE ?
- p->input_format : VAL_SUTRS))
+
+ p->output_format = p->input_format;
+
+ assert(p->input_format);
+ if (!oid_oidcmp(p->input_format, yaz_oid_xml()))
{
- case VAL_TEXT_XML:
#if 0
data1_pr_tree (p->dh, node, stdout);
#endif
if (!(p->rec_buf = data1_nodetoidsgml(p->dh, node, selected,
&p->rec_len)))
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
{
char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
memcpy (new_buf, p->rec_buf, p->rec_len);
p->rec_buf = new_buf;
}
- break;
- case VAL_GRS1:
+ }
+ else if (!oid_oidcmp(p->input_format, yaz_oid_grs1()))
+ {
data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
dummy = 0;
if (!(p->rec_buf = data1_nodetogr(p->dh, node, selected,
p->odr, &dummy)))
- p->diagnostic = 238; /* not available in requested syntax */
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
p->rec_len = -1;
- break;
- case VAL_EXPLAIN:
+ }
+ else if (!oid_oidcmp(p->input_format, yaz_oid_explain()))
+ {
/* ensure our data1 tree is UTF-8 */
data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
p->odr)))
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
p->rec_len = -1;
- break;
- case VAL_SUMMARY:
+ }
+ else if (!oid_oidcmp(p->input_format, yaz_oid_summary()))
+ {
/* ensure our data1 tree is UTF-8 */
data1_iconv (p->dh, mem, node, "UTF-8", data1_get_encoding(p->dh, node));
if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
p->odr)))
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
p->rec_len = -1;
- break;
- case VAL_SUTRS:
+ }
+ else if (!oid_oidcmp(p->input_format, yaz_oid_sutrs()))
+ {
if (p->encoding)
data1_iconv (p->dh, mem, node, p->encoding,
data1_get_encoding(p->dh, node));
if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
&p->rec_len)))
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
{
char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
memcpy (new_buf, p->rec_buf, p->rec_len);
p->rec_buf = new_buf;
}
- break;
- case VAL_SOIF:
+ }
+ else if (!oid_oidcmp(p->input_format, yaz_oid_soif()))
+ {
if (p->encoding)
data1_iconv (p->dh, mem, node, p->encoding,
data1_get_encoding(p->dh, node));
if (!(p->rec_buf = data1_nodetosoif(p->dh, node, selected,
&p->rec_len)))
- p->diagnostic = 238;
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
else
{
char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
memcpy (new_buf, p->rec_buf, p->rec_len);
p->rec_buf = new_buf;
}
- break;
- default:
+ }
+ else
+ {
if (!node->u.root.absyn)
- {
- p->diagnostic = 238;
- break;
- }
- for (marctab = node->u.root.absyn->marc; marctab;
- marctab = marctab->next)
- if (marctab->reference == p->input_format)
- break;
- if (!marctab)
- {
- p->diagnostic = 238;
- break;
- }
- if (p->encoding)
- data1_iconv (p->dh, mem, node, p->encoding,
- data1_get_encoding(p->dh, node));
- if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
- selected, &p->rec_len)))
- p->diagnostic = 238;
- else
- {
- char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
- memcpy (new_buf, p->rec_buf, p->rec_len);
- p->rec_buf = new_buf;
- }
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+ else
+ {
+ for (marctab = node->u.root.absyn->marc; marctab;
+ marctab = marctab->next)
+ if (marctab->oid && !oid_oidcmp(marctab->oid, p->input_format))
+ break;
+ if (!marctab)
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+ else
+ {
+ if (p->encoding)
+ data1_iconv (p->dh, mem, node, p->encoding,
+ data1_get_encoding(p->dh, node));
+ if (!(p->rec_buf = data1_nodetomarc(p->dh, marctab, node,
+ selected, &p->rec_len)))
+ p->diagnostic = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+ else
+ {
+ char *new_buf = (char*) odr_malloc (p->odr, p->rec_len);
+ memcpy (new_buf, p->rec_buf, p->rec_len);
+ p->rec_buf = new_buf;
+ }
+ }
+ }
}
nmem_destroy(mem);
return 0;
-/* $Id: rectext.c,v 1.4 2007-01-15 15:10:17 adam Exp $
+/* $Id: rectext.c,v 1.5 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <idzebra/util.h>
#include <idzebra/recctrl.h>
+#include <yaz/oid_db.h>
struct filter_info {
char *sep;
filter_ptr = p-filter_buf;
}
}
- p->output_format = VAL_SUTRS;
+ p->output_format = yaz_oid_sutrs();
p->rec_buf = filter_buf;
p->rec_len = filter_ptr;
return 0;
-/* $Id: retrieve.c,v 1.67 2007-03-19 21:50:39 adam Exp $
+/* $Id: retrieve.c,v 1.68 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include "index.h"
#include <yaz/diagbib1.h>
#include <direntz.h>
-
+#include <yaz/oid_db.h>
#define ZEBRA_XML_HEADER_STR "<record xmlns=\"http://www.indexdata.com/zebra/\""
int zebra_special_sort_fetch(ZebraHandle zh, zint sysno, ODR odr,
const char *elemsetname,
- oid_value input_format,
- oid_value *output_format,
+ const int *input_format,
+ const int **output_format,
char **rec_bufp, int *rec_lenp)
{
const char *retrieval_index;
int ord;
/* only accept XML and SUTRS requests */
- if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+ if (oid_oidcmp(input_format, yaz_oid_xml())
+ && oid_oidcmp(input_format, yaz_oid_sutrs()))
{
yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
elemsetname);
- *output_format = VAL_NONE;
+ *output_format = 0;
return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
}
zebra_term_untrans(zh, index_type, dst_buf, str);
- if (input_format == VAL_TEXT_XML)
+ if (!oid_oidcmp(input_format, yaz_oid_xml()))
{
- *output_format = VAL_TEXT_XML;
+ *output_format = yaz_oid_xml();
wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
" sysno=\"" ZINT_FORMAT "\""
" set=\"zebra::index%s/\">\n",
wrbuf_printf(wrbuf, "</index>\n");
wrbuf_printf(wrbuf, "</record>\n");
}
- else if (input_format == VAL_SUTRS)
+ else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
{
- *output_format = VAL_SUTRS;
+ *output_format = yaz_oid_sutrs();
wrbuf_printf(wrbuf, "%s %c %s\n", string_index, index_type,
dst_buf);
int zebra_special_index_fetch(ZebraHandle zh, zint sysno, ODR odr,
Record rec,
const char *elemsetname,
- oid_value input_format,
- oid_value *output_format,
+ const int *input_format,
+ const int **output_format,
char **rec_bufp, int *rec_lenp)
{
const char *retrieval_index;
/* *rec_lenp = 0; */
/* only accept XML and SUTRS requests */
- if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+ if (oid_oidcmp(input_format, yaz_oid_xml())
+ && oid_oidcmp(input_format, yaz_oid_sutrs()))
{
yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
elemsetname);
- *output_format = VAL_NONE;
+ *output_format = 0;
return YAZ_BIB1_NO_SYNTAXES_AVAILABLE_FOR_THIS_REQUEST;
}
if (!zebra_rec_keys_rewind(keys))
{
- ret_code =
- YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
+ ret_code = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
}
else
{
struct it_key key_in;
WRBUF wrbuf = wrbuf_alloc();
- if (input_format == VAL_TEXT_XML)
+ if (!oid_oidcmp(input_format, yaz_oid_xml()))
{
- *output_format = VAL_TEXT_XML;
+ *output_format = input_format;
wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
" sysno=\"" ZINT_FORMAT "\""
" set=\"zebra::index%s/\">\n",
sysno, elemsetname);
}
- else if (input_format == VAL_SUTRS)
- *output_format = VAL_SUTRS;
+ else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
+ *output_format = input_format;
while (zebra_rec_keys_read(keys, &str, &slen, &key_in))
{
zebra_term_untrans(zh, index_type, dst_buf, str);
if (strlen(dst_buf))
{
- if (input_format == VAL_TEXT_XML){
+ if (!oid_oidcmp(input_format, yaz_oid_xml()))
+ {
wrbuf_printf(wrbuf, " <index name=\"%s\"",
string_index);
wrbuf_xmlputs(wrbuf, dst_buf);
wrbuf_printf(wrbuf, "</index>\n");
}
- else if (input_format == VAL_SUTRS){
+ else
+ {
wrbuf_printf(wrbuf, "%s ", string_index);
wrbuf_printf(wrbuf, "%c", index_type);
for (i = 1; i < key_in.len; i++)
wrbuf_printf(wrbuf, " " ZINT_FORMAT,
key_in.mem[i]);
-
- /* zebra_term_untrans(zh, index_type, dst_buf, str); */
+
+ /* zebra_term_untrans(zh, index_type, dst_buf, str); */
wrbuf_printf(wrbuf, " %s", dst_buf);
wrbuf_printf(wrbuf, "\n");
}
}
}
- if (input_format == VAL_TEXT_XML)
+ if (!oid_oidcmp(input_format, yaz_oid_xml()))
wrbuf_printf(wrbuf, "</record>\n");
*rec_lenp = wrbuf_len(wrbuf);
*rec_bufp = odr_malloc(odr, *rec_lenp);
}
int zebra_special_fetch(ZebraHandle zh, zint sysno, int score, ODR odr,
- const char *elemsetname,
- oid_value input_format,
- oid_value *output_format,
- char **rec_bufp, int *rec_lenp)
+ const char *elemsetname,
+ const int *input_format,
+ const int **output_format,
+ char **rec_bufp, int *rec_lenp)
{
Record rec;
{
int ret = 0;
WRBUF wrbuf = wrbuf_alloc();
- if (input_format == VAL_SUTRS)
+ if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
{
wrbuf_printf(wrbuf, ZINT_FORMAT, sysno);
- *output_format = VAL_SUTRS;
+ *output_format = input_format;
}
- else if (input_format == VAL_TEXT_XML)
+ else if (!oid_oidcmp(input_format, yaz_oid_xml()))
{
wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
" sysno=\"" ZINT_FORMAT "\"/>\n",
sysno);
- *output_format = VAL_TEXT_XML;
+ *output_format = input_format;
}
*rec_lenp = wrbuf_len(wrbuf);
if (*rec_lenp)
}
/* only accept XML and SUTRS requests from now */
- if (input_format != VAL_TEXT_XML && input_format != VAL_SUTRS)
+ if (oid_oidcmp(input_format, yaz_oid_xml())
+ && oid_oidcmp(input_format, yaz_oid_sutrs()))
{
yaz_log(YLOG_WARN, "unsupported format for element set zebra::%s",
elemsetname);
WRBUF wrbuf = wrbuf_alloc();
RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, rec);
- if (input_format == VAL_TEXT_XML)
+ if (!oid_oidcmp(input_format, yaz_oid_xml()))
{
- *output_format = VAL_TEXT_XML;
+ *output_format = input_format;
wrbuf_printf(wrbuf, ZEBRA_XML_HEADER_STR
" sysno=\"" ZINT_FORMAT "\"", sysno);
recordAttr->recordSize,
elemsetname);
}
- else if (input_format == VAL_SUTRS)
+ else if (!oid_oidcmp(input_format, yaz_oid_sutrs()))
{
- *output_format = VAL_SUTRS;
+ *output_format = input_format;
wrbuf_printf(wrbuf, "sysno " ZINT_FORMAT "\n", sysno);
retrieve_puts_str(wrbuf, "base", rec->info[recInfo_databaseName]);
retrieve_puts_str(wrbuf, "file", rec->info[recInfo_filename]);
int zebra_record_fetch(ZebraHandle zh, zint sysno, int score,
zebra_snippets *hit_snippet, ODR odr,
- oid_value input_format, Z_RecordComposition *comp,
- oid_value *output_format,
+ const int *input_format, Z_RecordComposition *comp,
+ const int **output_format,
char **rec_bufp, int *rec_lenp, char **basenamep,
char **addinfo)
{
-/* $Id: rpnscan.c,v 1.6 2007-03-19 21:50:39 adam Exp $
+/* $Id: rpnscan.c,v 1.7 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <attrfind.h>
#include <charmap.h>
#include <rset.h>
+#include <yaz/oid_db.h>
#define RPN_MAX_ORDS 32
};
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
- oid_value attributeset,
+ const int *attributeset,
int num_bases, char **basenames,
int *position, int *num_entries, ZebraScanEntry **list,
int *is_partial, RSET limit_set)
*list = 0;
*is_partial = 0;
- if (attributeset == VAL_NONE)
- attributeset = VAL_BIB1;
+ if (!attributeset)
+ attributeset = yaz_oid_attset_bib1();
if (!limit_set) /* no limit set given already */
{
}
}
- yaz_log(YLOG_DEBUG, "position = %d, num = %d set=%d",
- *position, *num_entries, attributeset);
+ yaz_log(YLOG_DEBUG, "position = %d, num = %d",
+ *position, *num_entries);
if (zebra_maps_attr(zh->reg->zebra_maps, zapt, &index_type, &search_type,
rank_type, &complete_flag, &sort_flag))
-/* $Id: rpnsearch.c,v 1.10 2007-03-19 21:50:39 adam Exp $
+/* $Id: rpnsearch.c,v 1.11 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
*/
static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
const char **term_sub, char *term_dict,
- oid_value attributeSet,
+ const int *attributeSet,
int reg_type, int space_split, char *term_dst,
int *error_code)
{
static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
const char **term_sub,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
struct grep_info *grep_info,
int reg_type, int complete_flag,
int num_bases, char **basenames,
static ZEBRA_RES term_trunc(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char **term_sub,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
struct grep_info *grep_info,
int reg_type, int complete_flag,
int num_bases, char **basenames,
static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
const char **term_sub,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
struct grep_info *grep_info,
int reg_type, int complete_flag,
int num_bases, char **basenames,
static ZEBRA_RES term_list_trunc(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
int reg_type, int complete_flag,
const char *rank_type,
static ZEBRA_RES rpn_search_APT_position(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
- oid_value attributeSet,
+ const int *attributeSet,
int reg_type,
int num_bases, char **basenames,
NMEM rset_nmem,
static ZEBRA_RES rpn_search_APT_phrase(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz_org,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
int reg_type, int complete_flag,
const char *rank_type,
static ZEBRA_RES rpn_search_APT_or_list(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz_org,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
int reg_type, int complete_flag,
const char *rank_type,
static ZEBRA_RES rpn_search_APT_and_list(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz_org,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
int reg_type, int complete_flag,
const char *rank_type,
static int numeric_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
const char **term_sub,
char *term_dict,
- oid_value attributeSet,
+ const int *attributeSet,
struct grep_info *grep_info,
int *max_pos,
int reg_type,
static ZEBRA_RES numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
const char **term_sub,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
struct grep_info *grep_info,
int reg_type, int complete_flag,
int num_bases, char **basenames,
static ZEBRA_RES rpn_search_APT_numeric(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
int reg_type, int complete_flag,
const char *rank_type,
static ZEBRA_RES rpn_search_APT_local(ZebraHandle zh,
Z_AttributesPlusTerm *zapt,
const char *termz,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream,
const char *rank_type, NMEM rset_nmem,
RSET *rset,
}
static ZEBRA_RES rpn_sort_spec(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
Z_SortKeySpecList *sort_sequence,
const char *rank_type,
NMEM rset_nmem,
AttrType sort_relation_type;
Z_SortKeySpec *sks;
Z_SortKey *sk;
- int oid[OID_SIZE];
- oident oe;
char termz[20];
attr_init_APT(&sort_relation_type, zapt, 7);
i = 0;
sprintf(termz, "%d", i);
- oe.proto = PROTO_Z3950;
- oe.oclass = CLASS_ATTSET;
- oe.value = attributeSet;
- if (!oid_ent_to_oid (&oe, oid))
- return ZEBRA_FAIL;
-
sks = (Z_SortKeySpec *) nmem_malloc(stream, sizeof(*sks));
sks->sortElement = (Z_SortElement *)
nmem_malloc(stream, sizeof(*sks->sortElement));
sk->u.sortAttributes = (Z_SortAttributes *)
nmem_malloc(stream, sizeof(*sk->u.sortAttributes));
- sk->u.sortAttributes->id = oid;
+ sk->u.sortAttributes->id = odr_oiddup_nmem(stream, attributeSet);
sk->u.sortAttributes->list = zapt->attributes;
sks->sortRelation = (int *)
static int rpn_check_xpath(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
- oid_value attributeSet,
+ const int *attributeSet,
struct xpath_location_step *xpath, int max,
NMEM mem)
{
- oid_value curAttributeSet = attributeSet;
+ const int *curAttributeSet = attributeSet;
AttrType use;
const char *use_string = 0;
#define MAX_XPATH_STEPS 10
static ZEBRA_RES rpn_search_APT(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
- oid_value attributeSet, NMEM stream,
+ const int *attributeSet, NMEM stream,
Z_SortKeySpecList *sort_sequence,
int num_bases, char **basenames,
NMEM rset_nmem,
}
static ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream, NMEM rset_nmem,
Z_SortKeySpecList *sort_sequence,
int num_bases, char **basenames,
}
ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream, NMEM rset_nmem,
Z_SortKeySpecList *sort_sequence,
int num_bases, char **basenames,
}
ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs,
- oid_value attributeSet,
+ const int *attributeSet,
NMEM stream, NMEM rset_nmem,
Z_SortKeySpecList *sort_sequence,
int num_bases, char **basenames,
-/* $Id: safari.c,v 1.5 2007-01-15 15:10:17 adam Exp $
+/* $Id: safari.c,v 1.6 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
*/
-
+#include <yaz/oid_db.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
filter_ptr = p-filter_buf;
}
}
- p->output_format = VAL_SUTRS;
+ p->output_format = yaz_oid_sutrs();
p->rec_buf = filter_buf;
p->rec_len = filter_ptr;
return 0;
-/* $Id: zebraapi.c,v 1.252 2007-03-19 21:50:39 adam Exp $
+/* $Id: zebraapi.c,v 1.253 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include "orddict.h"
#include <charmap.h>
#include <idzebra/api.h>
+#include <yaz/oid_db.h>
#define DEFAULT_APPROX_LIMIT 2000000000
ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
const char *setname,
Z_RecordComposition *comp,
- oid_value input_format, int num_recs,
+ const int *input_format, int num_recs,
ZebraRetrievalRecord *recs)
{
ZebraMetaRecord *poset;
if (poset[i].term)
{
recs[i].errCode = 0;
- recs[i].format = VAL_SUTRS;
+ recs[i].format = yaz_oid_sutrs();
recs[i].len = strlen(poset[i].term);
recs[i].buf = poset[i].term;
recs[i].base = poset[i].db;
recs[i].buf = 0; /* no record and no error issued */
recs[i].len = 0;
recs[i].errCode = 0;
- recs[i].format = VAL_NONE;
+ recs[i].format = 0;
recs[i].sysno = 0;
}
}
zh->errCode = YAZ_BIB1_SCAN_MALFORMED_SCAN;
}
else
- res = zebra_scan(zh, stream, zapt, VAL_BIB1,
+ {
+ res = zebra_scan(zh, stream, zapt, yaz_oid_attset_bib1(),
position, num_entries, entries, is_partial,
setname);
+ }
yaz_pqf_destroy (pqf_parser);
return res;
}
ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
- oid_value attributeset,
+ const int *attributeset,
int *position,
int *num_entries, ZebraScanEntry **entries,
int *is_partial,
yaz_log(log_level, "zebra_search_PQF s=%s q=%s", setname, pqf_query);
- query = p_query_rpn (odr, PROTO_Z3950, pqf_query);
+ query = p_query_rpn(odr, pqf_query);
if (!query)
{
-/* $Id: zebrash.c,v 1.44 2007-03-19 21:50:39 adam Exp $
+/* $Id: zebrash.c,v 1.45 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/sortspec.h>
#include <yaz/options.h>
#include <yaz/wrbuf.h>
+#include <yaz/oid_db.h>
#define MAX_NO_ARGS 32
#define MAX_OUT_BUFF 4096
ODR odr;
Z_RecordComposition *pcomp=0;
int i;
- oid_value format;
- odr=odr_createmem(ODR_ENCODE);
+ odr = odr_createmem(ODR_ENCODE);
recs= odr_malloc(odr,sizeof(ZebraRetrievalRecord)*nrecs);
rc =z_RecordComposition(odr, &pcomp, 0,"recordComposition");
- format=oid_getvalbyname ("xml"); /*FIXME - let the user specify*/
+
for (i=0;i<nrecs;i++)
recs[i].position=start+i;
rc = zebra_records_retrieve (zh, odr, setname,
- pcomp, format, nrecs,recs);
+ pcomp, yaz_oid_xml(), nrecs,recs);
if (0==rc)
{
for (i=0;i<nrecs;i++)
-/* $Id: zebrasrv.c,v 1.12 2007-03-14 11:48:32 adam Exp $
+/* $Id: zebrasrv.c,v 1.13 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
r->search_info->list[0]->which = Z_OtherInfo_externallyDefinedInfo;
ext = odr_malloc (r->stream, sizeof(*ext));
r->search_info->list[0]->information.externallyDefinedInfo = ext;
- ext->direct_reference =
- yaz_oidval_to_z3950oid (r->stream, CLASS_USERINFO, VAL_SEARCHRES1);
+ ext->direct_reference = odr_oiddup(r->stream, yaz_oid_search_result_1());
ext->indirect_reference = 0;
ext->descriptor = 0;
ext->which = Z_External_searchResult1;
}
-int bend_fetch (void *handle, bend_fetch_rr *r)
+int bend_fetch(void *handle, bend_fetch_rr *r)
{
ZebraHandle zh = (ZebraHandle) handle;
ZebraRetrievalRecord retrievalRecord;
r->basename = retrievalRecord.base;
r->record = retrievalRecord.buf;
r->len = retrievalRecord.len;
- r->output_format = retrievalRecord.format;
+ r->output_format = odr_oiddup(r->stream, retrievalRecord.format);
}
return 0;
}
for (i = 0; notToKeep && i < notToKeep->num; i++)
{
Z_External *rec = notToKeep->elements[i]->record;
- struct oident *oident = 0;
Odr_oct *opaque_recid = 0;
zint *sysno = 0;
zint sysno_tmp;
}
if (rec->direct_reference)
{
- oident = oid_getentbyoid(rec->direct_reference);
- if (oident)
+ char oid_name_str[OID_STR_MAX];
+ const char *oid_name =
+ yaz_oid_to_string_buf(
+ rec->direct_reference,
+ 0, oid_name_str);
+ if (oid_name)
yaz_log (YLOG_LOG, "record %d type %s", i,
- oident->desc);
+ oid_name);
}
switch (rec->which)
{
rec->u.octet_aligned->len,
rec->u.octet_aligned->buf);
}
- if (oident && oident->value != VAL_TEXT_XML
- && oident->value != VAL_SUTRS)
- {
- rr->errcode = YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
- rr->errstring = "only XML update supported";
- break;
- }
if (rec->which == Z_External_octet)
{
enum zebra_recctrl_action_t action = action_update;
-/* $Id: zinfo.c,v 1.77 2007-02-24 16:47:16 adam Exp $
+/* $Id: zinfo.c,v 1.78 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
if (!ao)
{
ao = (zebAccessObject) nmem_malloc(zei->nmem, sizeof(*ao));
- ao->handle = NULL;
+ ao->handle = 0;
ao->sysno = 1;
ao->oid = oid;
ao->next = *op;
{
*accessInfo = (zebAccessInfo)
nmem_malloc(zei->nmem, sizeof(**accessInfo));
- (*accessInfo)->attributeSetIds = NULL;
- (*accessInfo)->schemas = NULL;
+ (*accessInfo)->attributeSetIds = 0;
+ (*accessInfo)->schemas = 0;
}
else
{
zei->updateFunc = updateFunc;
zei->dirty = 0;
zei->ordinalDatabase = 1;
- zei->curDatabaseInfo = NULL;
+ zei->curDatabaseInfo = 0;
zei->records = records;
zei->nmem = nmem;
zei->dh = dh;
data1_get_absyn (zei->dh, "explain", DATA1_XPATH_INDEXING_DISABLE);
- zei->attsets = NULL;
+ zei->attsets = 0;
zei->res = res;
zei->categoryList = (struct zebraCategoryListInfo *)
nmem_malloc(zei->nmem, sizeof(*zei->categoryList));
zei->categoryList->sysno = 0;
zei->categoryList->dirty = 0;
- zei->categoryList->data1_categoryList = NULL;
+ zei->categoryList->data1_categoryList = 0;
if ( atoi(res_get_def(res, "notimestamps", "0") )== 0)
{
}
for(; np; np = np->next)
{
- data1_node *node_name = NULL;
- data1_node *node_id = NULL;
- data1_node *node_aid = NULL;
+ data1_node *node_name = 0;
+ data1_node *node_id = 0;
+ data1_node *node_aid = 0;
data1_node *np2;
if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "database"))
continue;
nmem_malloc(zei->nmem, sizeof(**zdip));
(*zdip)->readFlag = 1;
(*zdip)->dirty = 0;
- (*zdip)->data1_database = NULL;
+ (*zdip)->data1_database = 0;
(*zdip)->recordCount = 0;
(*zdip)->recordBytes = 0;
zebraExplain_mergeAccessInfo (zei, 0, &(*zdip)->accessInfo);
node_aid->u.data.len);
(*zdip)->attributeDetails->readFlag = 1;
(*zdip)->attributeDetails->dirty = 0;
- (*zdip)->attributeDetails->SUInfo = NULL;
+ (*zdip)->attributeDetails->SUInfo = 0;
zdip = &(*zdip)->next;
}
assert (np && np->which == DATA1N_data);
zei->runNumber = atoi_zn(np->u.data.data, np->u.data.len);
yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
- *zdip = NULL;
+ *zdip = 0;
}
rec_free(&trec);
}
{
data1_node *node_tgtinfo;
- *zdip = NULL;
+ *zdip = 0;
if (writeFlag)
{
char *sgml_buf;
"attrlist");
for (np = node_list->child; np; np = np->next)
{
- data1_node *node_str = NULL;
- data1_node *node_ordinal = NULL;
- data1_node *node_type = NULL;
- data1_node *node_cat = NULL;
- data1_node *node_doc_occurrences = NULL;
- data1_node *node_term_occurrences = NULL;
+ data1_node *node_str = 0;
+ data1_node *node_ordinal = 0;
+ data1_node *node_type = 0;
+ data1_node *node_cat = 0;
+ data1_node *node_doc_occurrences = 0;
+ data1_node *node_term_occurrences = 0;
data1_node *np2;
if (np->which != DATA1N_tag || strcmp(np->u.tag.tag, "attr"))
node_ordinal->u.data.len);
zsuip = &(*zsuip)->next;
}
- *zsuip = NULL;
+ *zsuip = 0;
zad->readFlag = 0;
rec_free(&rec);
}
zdi->attributeDetails->readFlag = 0;
zdi->attributeDetails->sysno = 0;
zdi->attributeDetails->dirty = 1;
- zdi->attributeDetails->SUInfo = NULL;
+ zdi->attributeDetails->SUInfo = 0;
zdi->attributeDetails->data1_tree =
data1_read_sgml (zei->dh, zei->nmem,
"<explain><attributeDetails>AttributeDetails\n"
"TargetInfo",
"DatabaseInfo",
"AttributeDetails",
- NULL
+ 0
};
assert (zcl);
Record drec;
data1_node *node_root, *node_attinfo, *node_attributes, *node_atttype;
data1_node *node_values;
- struct oident *entp;
- struct data1_attset *attset = NULL;
-
- if ((entp = oid_getentbyoid (o->oid)))
- attset = data1_attset_search_id (zei->dh, entp->value);
+ struct data1_attset *attset = 0;
+
+ if (o->oid)
+ attset = data1_attset_search_id (zei->dh, o->oid);
#if ZINFO_DEBUG
yaz_log(YLOG_LOG, "zebraExplain_writeAttributeSet %s",
if (!ao)
{
ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao));
- ao->handle = NULL;
+ ao->handle = 0;
ao->sysno = 0;
ao->oid = odr_oiddup_nmem (zei->nmem, oid);
ao->next = *op;
return ao;
}
-void zebraExplain_addAttributeSet (ZebraExplainInfo zei, int set)
-{
- oident oe;
- int oid[OID_SIZE];
-
- oe.proto = PROTO_Z3950;
- oe.oclass = CLASS_ATTSET;
- oe.value = (enum oid_value) set;
-
- if (oid_ent_to_oid (&oe, oid))
- {
- zebraExplain_announceOid (zei, &zei->accessInfo->attributeSetIds, oid);
- zebraExplain_announceOid (zei, &zei->curDatabaseInfo->
- accessInfo->attributeSetIds, oid);
- }
-}
-
struct zebSUInfoB *zebraExplain_add_sui_info(ZebraExplainInfo zei,
zinfo_index_category_t cat,
int index_type)
-/* $Id: zsets.c,v 1.120 2007-03-20 22:07:35 adam Exp $
+/* $Id: zsets.c,v 1.121 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
Z_RPNQuery *rpn, ZebraSet sset)
{
RSET rset = 0;
- oident *attrset;
Z_SortKeySpecList *sort_sequence;
int sort_status, i;
ZEBRA_RES res = ZEBRA_OK;
for (i = 0; i<sort_sequence->num_specs; i++)
sort_sequence->specs[i] = 0;
- attrset = oid_getentbyoid (rpn->attributeSetId);
-
rpn_get_top_approx_limit(zh, rpn->RPNStructure, &sset->approx_limit);
- res = rpn_search_top(zh, rpn->RPNStructure, attrset->value,
+ res = rpn_search_top(zh, rpn->RPNStructure, rpn->attributeSetId,
nmem, rset_nmem,
sort_sequence,
sset->num_bases, sset->basenames,
-/* $Id: t16.c,v 1.9 2007-01-15 15:10:20 adam Exp $
+/* $Id: t16.c,v 1.10 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#define NUMBER_TO_FETCH_MAX 1000
static ZEBRA_RES fetch_first(ZebraHandle zh, const char *element_set,
- oid_value format, ODR odr,
+ const int * format, ODR odr,
const char **rec_buf, size_t *rec_len)
{
ZebraRetrievalRecord retrievalRecord[1];
}
static ZEBRA_RES fetch_first_compare(ZebraHandle zh, const char *element_set,
- oid_value format, const char *cmp_rec)
+ const int *format, const char *cmp_rec)
{
const char *rec_buf = 0;
size_t rec_len = 0;
YAZ_CHECK_EQ(res, ZEBRA_OK);
YAZ_CHECK_EQ(hits, 1);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_xml(),
"mismatch"), ZEBRA_FAIL);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_SUTRS,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_sutrs(),
myrec[0]), ZEBRA_OK);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", VAL_TEXT_XML,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::data", yaz_oid_xml(),
myrec[0]), ZEBRA_OK);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_SUTRS,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", yaz_oid_sutrs(),
"2"), ZEBRA_OK);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", VAL_TEXT_XML,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta::sysno", yaz_oid_xml(),
zebra_xml_sysno), ZEBRA_OK);
- YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta", VAL_TEXT_XML,
+ YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::meta", yaz_oid_xml(),
zebra_xml_meta), ZEBRA_OK);
YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::title:p",
- VAL_TEXT_XML,
+ yaz_oid_xml(),
zebra_xml_index_title_p), ZEBRA_OK);
YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::nonexistent",
- VAL_TEXT_XML, ""), ZEBRA_OK);
+ yaz_oid_xml(), ""), ZEBRA_OK);
YAZ_CHECK_EQ(fetch_first_compare(zh, "zebra::index::nonexistent",
- VAL_TEXT_XML, ""), ZEBRA_OK);
+ yaz_oid_xml(), ""), ZEBRA_OK);
YAZ_CHECK(tl_close_down(zh, zs));
}
-/* $Id: t4.c,v 1.22 2007-01-15 15:10:20 adam Exp $
+/* $Id: t4.c,v 1.23 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
retrievalRecord[j].position = j+1;
ret = zebra_records_retrieve(zh, odr_output, setname, 0,
- VAL_TEXT_XML, number_to_fetch,
+ yaz_oid_xml(), number_to_fetch,
retrievalRecord);
if (ret != ZEBRA_OK)
{
-/* $Id: testlib.c,v 1.42 2007-01-15 15:10:20 adam Exp $
+/* $Id: testlib.c,v 1.43 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <assert.h>
#include <yaz/log.h>
#include <yaz/pquery.h>
+#include <yaz/oid_db.h>
#include <idzebra/api.h>
#include "testlib.h"
odr_output = odr_createmem(ODR_ENCODE);
rc = zebra_records_retrieve(zh, odr_output, setname, 0,
- VAL_TEXT_XML, exphits, retrievalRecord);
+ yaz_oid_xml(), exphits, retrievalRecord);
if (rc != ZEBRA_OK)
ret = 0;
else if (!strstr(retrievalRecord[0].buf, firstrec))
-/* $Id: testlib.h,v 1.24 2007-01-15 20:08:26 adam Exp $
+/* $Id: testlib.h,v 1.25 2007-04-16 08:44:32 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <yaz/log.h>
#include <idzebra/api.h>
#include <yaz/test.h>
+#include <yaz/oid_db.h>
/**
* tl_start_up : Does all the usual start functions
-/* $Id: attrfind.c,v 1.2 2007-01-15 15:10:26 adam Exp $
+/* $Id: attrfind.c,v 1.3 2007-04-16 08:44:33 adam Exp $
Copyright (C) 2005-2007
Index Data ApS
src->minor = 0;
}
-int attr_find_ex(AttrType *src, oid_value *attributeSetP,
+int attr_find_ex(AttrType *src, const int **attribute_set_oid,
const char **string_value)
{
int num_attributes;
{
case Z_AttributeValue_numeric:
++(src->major);
- if (element->attributeSet && attributeSetP)
- {
- oident *attrset;
-
- attrset = oid_getentbyoid(element->attributeSet);
- *attributeSetP = attrset->value;
- }
+ if (element->attributeSet && attribute_set_oid)
+ *attribute_set_oid = element->attributeSet;
return *element->value.numeric;
break;
case Z_AttributeValue_complex:
if (src->minor >= element->value.complex->num_list)
break;
- if (element->attributeSet && attributeSetP)
- {
- oident *attrset;
-
- attrset = oid_getentbyoid(element->attributeSet);
- *attributeSetP = attrset->value;
- }
+ if (element->attributeSet && attribute_set_oid)
+ *attribute_set_oid = element->attributeSet;
if (element->value.complex->list[src->minor]->which ==
Z_StringOrNumeric_numeric)
{
return -1;
}
-int attr_find(AttrType *src, oid_value *attributeSetP)
+int attr_find(AttrType *src, const int **attribute_set_id)
{
- return attr_find_ex(src, attributeSetP, 0);
+ return attr_find_ex(src, attribute_set_id, 0);
}