Finish Latin-1 to MARC-8 conversion handling.
[yaz-moved-to-github.git] / src / seshigh.c
index d355260..3cc1b38 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.80 2006-05-09 13:39:47 adam Exp $
  */
 /**
  * \file seshigh.c
@@ -582,6 +582,10 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
     const char *match_schema = 0;
     int *match_syntax = 0;
 
+    if (!assoc->server)
+    {
+        yaz_log(YLOG_LOG, "no assoc->server");
+    }
     if (assoc->server)
     {
         int r;
@@ -591,6 +595,8 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
         const char *backend_schema = 0;
         Odr_oid *backend_syntax = 0;
 
+        yaz_log(YLOG_LOG, "found assoc->server");
+
         r = yaz_retrieval_request(assoc->server->retrieval,
                                   input_schema,
                                   input_syntax_raw,
@@ -599,6 +605,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 +616,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 +627,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)
@@ -677,6 +677,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
         rr->output_format = oi ? oi->value : VAL_NONE;
         rr->output_format_raw = match_syntax;
     }
+    yaz_log(YLOG_LOG, "match_scheam=%s", match_schema);
     if (match_schema)
         rr->schema = odr_strdup(rr->stream, match_schema);
     return 0;
@@ -697,7 +698,7 @@ static int srw_bend_fetch(association *assoc, int pos,
     rr.referenceId = 0;
     rr.request_format = VAL_TEXT_XML;
     rr.request_format_raw = yaz_oidval_to_z3950oid(assoc->decode,
-                                                   CLASS_TRANSYN,
+                                                   CLASS_RECSYN,
                                                    VAL_TEXT_XML);
     rr.comp = (Z_RecordComposition *)
             odr_malloc(assoc->decode, sizeof(*rr.comp));
@@ -738,8 +739,6 @@ static int srw_bend_fetch(association *assoc, int pos,
     rr.len = 0;
     rr.record = 0;
     rr.last_in_set = 0;
-    rr.output_format = VAL_TEXT_XML;
-    rr.output_format_raw = 0;
     rr.errcode = 0;
     rr.errstring = 0;
     rr.surrogate_flag = 0;
@@ -2241,7 +2240,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.80 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,