Added cql2pqf which shows evalutation order
[yaz-moved-to-github.git] / src / seshigh.c
index d74a617..768e22a 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: seshigh.c,v 1.84 2006-05-30 04:50:04 quinn Exp $
+ * $Id: seshigh.c,v 1.87 2006-06-20 21:20:51 adam Exp $
  */
 /**
  * \file seshigh.c
@@ -1015,13 +1015,20 @@ static void srw_bend_search(association *assoc, request *req,
                             bprr->start = start;
                             bprr->number = number;
                             bprr->format = VAL_TEXT_XML;
-                            bprr->comp = (Z_RecordComposition *) odr_malloc(assoc->decode,
-                                    sizeof(*bprr->comp));
-                            bprr->comp->which = Z_RecordComp_simple;
-                            bprr->comp->u.simple = (Z_ElementSetNames *)
-                                odr_malloc(assoc->decode, sizeof(Z_ElementSetNames));
-                            bprr->comp->u.simple->which = Z_ElementSetNames_generic;
-                            bprr->comp->u.simple->u.generic = srw_req->recordSchema;
+                            if (srw_req->recordSchema)
+                            {
+                                bprr->comp = (Z_RecordComposition *) odr_malloc(assoc->decode,
+                                        sizeof(*bprr->comp));
+                                bprr->comp->which = Z_RecordComp_simple;
+                                bprr->comp->u.simple = (Z_ElementSetNames *)
+                                    odr_malloc(assoc->decode, sizeof(Z_ElementSetNames));
+                                bprr->comp->u.simple->which = Z_ElementSetNames_generic;
+                                bprr->comp->u.simple->u.generic = srw_req->recordSchema;
+                            }
+                            else
+                            {
+                                bprr->comp = 0;
+                            }
                             bprr->stream = assoc->encode;
                             bprr->referenceId = 0;
                             bprr->print = assoc->print;
@@ -1433,8 +1440,9 @@ static void srw_bend_update(association *assoc, request *req,
         rr.response_extra_record = 0;
         rr.extra_request_data = 0;
         rr.extra_response_data = 0;
-        rr.errcode = 0;
-        rr.errstring = 0;
+        rr.uri = 0;
+        rr.message = 0;
+        rr.details = 0;
 
         yaz_log(YLOG_DEBUG, "basename = %s", rr.basenames[0] );
         yaz_log(YLOG_DEBUG, "Operation = %s", rr.operation );
@@ -1513,6 +1521,7 @@ static void srw_bend_update(association *assoc, request *req,
        }
        else if ( !strcmp( rr.operation, "insert" ) )
         {
+            rr.record_id = srw_req->recordId; 
             if ( srw_req->record.recordSchema == 0 ){
                 yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
                                        &srw_res->num_diagnostics,
@@ -1559,11 +1568,14 @@ static void srw_bend_update(association *assoc, request *req,
                 return;
             }
         }
-        if (rr.errcode)
-            yaz_add_srw_diagnostic(assoc->encode,
-                                   &srw_res->diagnostics,
-                                   &srw_res->num_diagnostics,
-                                   rr.errcode, rr.errstring);
+
+        if (rr.uri)
+            yaz_add_srw_diagnostic_uri(assoc->encode,
+                                       &srw_res->diagnostics,
+                                       &srw_res->num_diagnostics,
+                                       rr.uri, 
+                                       rr.message,
+                                       rr.details);
        srw_res->recordId = rr.record_id;
        srw_res->operationStatus = rr.operation_status;
        srw_res->recordVersion = rr.record_version;
@@ -2237,7 +2249,8 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
         strcat(options, " negotiation");
     }
         
-    ODR_MASK_SET(resp->options, Z_Options_triggerResourceCtrl);
+    if (ODR_MASK_GET(req->options, Z_Options_triggerResourceCtrl))
+        ODR_MASK_SET(resp->options, Z_Options_triggerResourceCtrl);
 
     if (ODR_MASK_GET(req->protocolVersion, Z_ProtocolVersion_1))
     {
@@ -2275,7 +2288,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.84 $");
+    version = odr_strdup(assoc->encode, "$Revision: 1.87 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,