X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=index%2Fattribute.c;h=d01230e6bac19a36afa37116b76ca1271b450da8;hb=e150e51a7e20a902e9fd2f11f00811f94f67d529;hp=3548f3aeaf22ab3c8da8c39dd9e644c44c7614a2;hpb=ce3907338568fce46c5751e7e1091a5ad1c8e291;p=idzebra-moved-to-github.git diff --git a/index/attribute.c b/index/attribute.c index 3548f3a..d01230e 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -1,10 +1,20 @@ /* - * Copyright (C) 1994-1998, Index Data I/S + * Copyright (C) 1994-1999, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: attribute.c,v $ - * Revision 1.8 1998-03-05 08:45:11 adam + * Revision 1.11 1999-11-30 13:48:03 adam + * Improved installation. Updated for inclusion of YAZ header files. + * + * Revision 1.10 1999/02/02 14:50:49 adam + * Updated WIN32 code specific sections. Changed header. + * + * Revision 1.9 1998/05/20 10:12:14 adam + * Implemented automatic EXPLAIN database maintenance. + * Modified Zebra to work with ASN.1 compiled version of YAZ. + * + * Revision 1.8 1998/03/05 08:45:11 adam * New result set model and modular ranking system. Moved towards * descent server API. System information stored as "SGML" records. * @@ -35,44 +45,24 @@ #include -#include +#include #include #include #include "zserver.h" -static void att_loadset(void *p, const char *n, const char *name) -{ - data1_attset *cnew; - ZebraHandle zi = p; - - if (!(cnew = data1_read_attset(zi->dh, (char*) name))) - { - logf(LOG_WARN|LOG_ERRNO, "%s", name); - return; - } - cnew->next = zi->registered_sets; - zi->registered_sets = cnew; -} - -static void load_atts(ZebraHandle zi) -{ - res_trav(zi->res, "attset", zi, att_loadset); -} - static data1_att *getatt(data1_attset *p, int att) { data1_att *a; + data1_attset_child *c; - for (; p; p = p->next) - { - /* scan local set */ - for (a = p->atts; a; a = a->next) - if (a->value == att) - return a; - /* scan included sets */ - if (p->children && (a = getatt(p->children, att))) + /* scan local set */ + for (a = p->atts; a; a = a->next) + if (a->value == att) + return a; + /* scan included sets */ + for (c = p->children; c; c = c->next) + if ((a = getatt(c->child, att))) return a; - } return 0; } @@ -81,16 +71,16 @@ int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att) data1_att *r; data1_attset *p; - if (!zi->registered_sets) - load_atts(zi); - for (p = zi->registered_sets; p; p = p->next) - if (p->reference == set) - break; + if (!(p = data1_attset_search_id (zi->dh, set))) + { + zebraExplain_loadAttsets (zi->dh, zi->res); + p = data1_attset_search_id (zi->dh, set); + } if (!p) return -2; if (!(r = getatt(p, att))) return -1; - res->attset_ordinal = r->parent->ordinal; + res->attset_ordinal = r->parent->reference; res->local_attributes = r->locals; return 0; }