Fixed minor bugs regarding DB Update (introduced by previous commit).
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 26 May 1999 15:24:26 +0000 (15:24 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 26 May 1999 15:24:26 +0000 (15:24 +0000)
asn/prt-ext.c
client/client.c
server/seshigh.c

index 3206d87..33095a4 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: prt-ext.c,v $
- * Revision 1.21  1999-05-26 14:47:12  adam
+ * Revision 1.22  1999-05-26 15:24:26  adam
+ * Fixed minor bugs regarding DB Update (introduced by previous commit).
+ *
+ * Revision 1.21  1999/05/26 14:47:12  adam
  * Implemented z_ext_record.
  *
  * Revision 1.20  1999/04/20 09:56:48  adam
@@ -213,8 +216,6 @@ Z_External *z_ext_record(ODR o, int format, const char *buf, int len)
     if (!oid_ent_to_oid(&recform, oid))
        return 0;
     thisext->direct_reference = odr_oiddup(o, oid);
-    thisext->indirect_reference = 0;
-    thisext->descriptor = 0;
     
     if (len < 0) /* Structured data */
     {
index 653ab41..9b17c9c 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: client.c,v $
- * Revision 1.82  1999-05-26 13:49:12  adam
+ * Revision 1.83  1999-05-26 15:24:26  adam
+ * Fixed minor bugs regarding DB Update (introduced by previous commit).
+ *
+ * Revision 1.82  1999/05/26 13:49:12  adam
  * DB Update implemented in client (very basic).
  *
  * Revision 1.81  1999/04/20 09:56:48  adam
@@ -1139,10 +1142,8 @@ static Z_External *CreateItemOrderExternal(int itemno)
     ItemOrderRequest.value = VAL_ITEMORDER;
  
     r->direct_reference = odr_oiddup(out,oid_getoidbyent(&ItemOrderRequest)); 
-    r->indirect_reference = (int *) odr_malloc(out,sizeof(int));
-    *r->indirect_reference = 0;
-
-    r->descriptor = "Extended services item order";
+    r->indirect_reference = 0;
+    r->descriptor = 0;
 
     r->which = Z_External_itemOrder;
 
@@ -1234,6 +1235,8 @@ static int cmd_update(char *arg)
     r = req->taskSpecificParameters = (Z_External *)
        odr_malloc (out, sizeof(*r));
     r->direct_reference = odr_oiddup(out,oid);
+    r->indirect_reference = 0;
+    r->descriptor = 0;
     r->which = Z_External_update;
     r->u.update = (Z_IUUpdate *) odr_malloc(out, sizeof(*r->u.update));
     r->u.update->which = Z_IUUpdate_esRequest;
@@ -1242,6 +1245,9 @@ static int cmd_update(char *arg)
     toKeep = r->u.update->u.esRequest->toKeep = (Z_IUOriginPartToKeep *)
        odr_malloc(out, sizeof(*r->u.update->u.esRequest->toKeep));
     toKeep->databaseName = databaseNames[0];
+    toKeep->schema = 0;
+    toKeep->elementSetName = 0;
+    toKeep->actionQualifier = 0;
     toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
     *toKeep->action = Z_IUOriginPartToKeep_recordInsert;
 
index 121f212..faa1f63 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: seshigh.c,v $
- * Revision 1.88  1999-04-20 09:56:48  adam
+ * Revision 1.89  1999-05-26 15:24:26  adam
+ * Fixed minor bugs regarding DB Update (introduced by previous commit).
+ *
+ * Revision 1.88  1999/04/20 09:56:48  adam
  * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
  * Modified all encoders/decoders to reflect this change.
  *
@@ -1137,70 +1140,10 @@ static Z_Records *pack_records(association *a, char *setname, int start,
            return 0;
        strcpy(thisrec->databaseName, fres->basename);
        thisrec->which = Z_NamePlusRecord_databaseRecord;
-       if (!(thisrec->u.databaseRecord = thisext = (Z_External *)
-             odr_malloc(a->encode, sizeof(Z_DatabaseRecord))))
+       thisrec->u.databaseRecord = z_ext_record(a->encode, fres->format,
+                                                fres->record, fres->len);
+       if (!thisrec->u.databaseRecord)
            return 0;
-       recform.proto = a->proto;
-       recform.oclass = CLASS_RECSYN;
-       recform.value = fres->format;
-       thisext->direct_reference =
-           odr_oiddup(a->encode, oid_ent_to_oid(&recform, oid));
-       thisext->indirect_reference = 0;
-       thisext->descriptor = 0;
-       if (fres->len < 0) /* Structured data */
-       {
-           switch (fres->format)
-           {
-               case VAL_SUTRS: thisext->which = Z_External_sutrs; break;
-               case VAL_GRS1: thisext->which = Z_External_grs1; break;
-               case VAL_EXPLAIN: thisext->which = Z_External_explainRecord;
-                   break;
-               case VAL_SUMMARY: thisext->which = Z_External_summary; break;
-               case VAL_OPAC: thisext->which = Z_External_OPAC; break;
-
-               default:
-                   logf(LOG_FATAL, "Unknown structured format from backend.");
-                   return 0;
-           }
-
-           /*
-            * We cheat on the pointers here. Obviously, the record field
-            * of the backend-fetch structure should have been a union for
-            * correctness, but we're stuck with this for backwards
-            * compatibility.
-            */
-           thisext->u.grs1 = (Z_GenericRecord*) fres->record;
-       }
-       else if (fres->format == VAL_SUTRS) /* SUTRS is a single-ASN.1-type */
-       {
-#if 0
-           Z_SUTRS *sutrs = (Z_SUTRS *)odr_malloc(a->encode, 1+fres->len);
-            
-           memcpy(sutrs, fres->record, fres->len);
-           sutrs[fres->len] = '\0';
-#else
-           Odr_oct *sutrs = (Odr_oct *)odr_malloc(a->encode, sizeof(*sutrs));
-
-           thisext->which = Z_External_sutrs;
-           thisext->u.sutrs = sutrs;
-           sutrs->buf = (unsigned char *)odr_malloc(a->encode, fres->len);
-           sutrs->len = sutrs->size = fres->len;
-           memcpy(sutrs->buf, fres->record, fres->len);
-#endif
-       }
-       else /* octet-aligned record. */
-       {
-           thisext->which = Z_External_octet;
-           if (!(thisext->u.octet_aligned = (Odr_oct *)odr_malloc(a->encode,
-               sizeof(Odr_oct))))
-               return 0;
-           if (!(thisext->u.octet_aligned->buf = (unsigned char *)
-                 odr_malloc(a->encode, fres->len)))
-               return 0;
-           memcpy(thisext->u.octet_aligned->buf, fres->record, fres->len);
-           thisext->u.octet_aligned->len = thisext->u.octet_aligned->size =
-               fres->len;
-       }
        reclist->records[reclist->num_records] = thisrec;
        reclist->num_records++;
        *next = fres->last_in_set ? 0 : recno + 1;