Change return values for yaz_retrieval_request a bit and improve
[yaz-moved-to-github.git] / src / seshigh.c
index d355260..f6dedb5 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: seshigh.c,v 1.78 2006-05-08 10:16:47 adam Exp $
+ * $Id: seshigh.c,v 1.79 2006-05-08 19:48:26 adam Exp $
  */
 /**
  * \file seshigh.c
@@ -599,6 +599,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
                                   &rc,
                                   &backend_schema,
                                   &backend_syntax);
+        yaz_log(YLOG_LOG, "yaz_retrieval_request r=%d", r);
         if (r == -1) /* error ? */
         {
             const char *details = yaz_retrieval_get_error(
@@ -609,7 +610,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
                 rr->errstring = odr_strdup(rr->stream, details);
             return -1;
         }
-        else if (r == 1)
+        else if (r == 1 || r == 3)
         {
             const char *details = input_schema;
             rr->errcode =  YAZ_BIB1_ELEMENT_SET_NAMES_UNSUPP;
@@ -620,19 +621,12 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
         else if (r == 2)
         {
             rr->errcode = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
-            return -1;
-        }
-        else if (r == 3)
-        {
-            const char *details = input_schema;
-            rr->errcode =  YAZ_BIB1_ELEMENT_SET_NAMES_UNSUPP;
-            if (details)
-                rr->errstring = odr_strdup(rr->stream, details);
-            return -1;
-        }
-        else if (r == 4)
-        {
-            rr->errcode = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX; 
+            if (input_syntax_raw)
+            {
+                char oidbuf[OID_STR_MAX];
+                oid_to_dotstring(input_syntax_raw, oidbuf);
+                rr->errstring = odr_strdup(rr->stream, oidbuf);
+            }
             return -1;
         }
         if (backend_schema)
@@ -2241,7 +2235,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
                 assoc->init->implementation_name,
                 odr_prepend(assoc->encode, "GFS", resp->implementationName));
 
-    version = odr_strdup(assoc->encode, "$Revision: 1.78 $");
+    version = odr_strdup(assoc->encode, "$Revision: 1.79 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,