X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fretrieval.c;h=450be15cb2e68065fa54b6f803f70b4c48273ed6;hb=7d849f69c1386fbeb27eefcc60b8d0ffbdd5218c;hp=af13ae912568a5616cc087574828ebf3c69f53ce;hpb=0b20fc2dcafe8d56501a3b34626b3174c60eefb5;p=yaz-moved-to-github.git diff --git a/src/retrieval.c b/src/retrieval.c index af13ae9..450be15 100644 --- a/src/retrieval.c +++ b/src/retrieval.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: retrieval.c,v 1.5 2006-05-08 10:16:47 adam Exp $ + * $Id: retrieval.c,v 1.8 2006-05-09 11:09:09 mike Exp $ */ /** * \file retrieval.c @@ -239,9 +239,12 @@ int yaz_retrieval_request(yaz_retrieval_t p, int **backend_syntax) { struct yaz_retrieval_elem *el = p->list; - int syntax_matches = 0; int schema_matches = 0; + + wrbuf_rewind(p->wr_error); + if (!el) + return 0; for(; el; el = el->next) { int schema_ok = 0; @@ -253,6 +256,8 @@ int yaz_retrieval_request(yaz_retrieval_t p, schema_ok = 1; if (!schema) schema_ok = 1; + if (schema && !el->schema) + schema_ok = 1; if (syntax && el->syntax && !oid_oidcmp(syntax, el->syntax)) syntax_ok = 1; @@ -276,13 +281,17 @@ int yaz_retrieval_request(yaz_retrieval_t p, return 0; } } - if (syntax_matches && !schema_matches) - return 1; - if (!syntax_matches && schema_matches) + if (!syntax_matches && syntax) + { + char buf[100]; + wrbuf_printf(p->wr_error, "%s", oid_to_dotstring(syntax, buf)); return 2; - if (!syntax_matches && !schema_matches) - return 3; - return 4; + } + if (schema) + wrbuf_printf(p->wr_error, "%s", schema); + if (!schema_matches) + return 1; + return 3; } const char *yaz_retrieval_get_error(yaz_retrieval_t p)