record fetch method ext that returns YAZ Z_External
[yaz-moved-to-github.git] / zoom / zoom-c.c
index 1d22eae..3fbd46b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoom-c.c,v 1.36 2002-07-11 10:39:05 adam Exp $
+ * $Id: zoom-c.c,v 1.38 2002-07-29 19:51:34 adam Exp $
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
@@ -1151,6 +1151,30 @@ ZOOM_record_get (ZOOM_record rec, const char *type, int *len)
     else if (!strcmp (type, "raw"))
     {
        if (npr->which == Z_NamePlusRecord_databaseRecord)
+       {
+           Z_External *r = (Z_External *) npr->u.databaseRecord;
+           
+           if (r->which == Z_External_sutrs)
+           {
+               if (len) *len = r->u.sutrs->len;
+               return (const char *) r->u.sutrs->buf;
+           }
+           else if (r->which == Z_External_octet)
+           {
+               if (len) *len = r->u.octet_aligned->len;
+               return (const char *) r->u.octet_aligned->buf;
+           }
+           else /* grs-1, explain, ... */
+           {
+               if (len) *len = -1;
+                return (const char *) npr->u.databaseRecord;
+           }
+       }
+       return 0;
+    }
+    else if (!strcmp (type, "ext"))
+    {
+       if (npr->which == Z_NamePlusRecord_databaseRecord)
             return (const char *) npr->u.databaseRecord;
        return 0;
     }
@@ -2314,7 +2338,7 @@ ZOOM_event (int no, ZOOM_connection *cs)
 #if HAVE_SYS_POLL_H
 
 #else
-    tv.tv_sec = 15;
+    tv.tv_sec = 25;
     tv.tv_usec = 0;
     
     FD_ZERO (&input);
@@ -2375,7 +2399,7 @@ ZOOM_event (int no, ZOOM_connection *cs)
     if (!nfds)
         return 0;
 #if HAVE_SYS_POLL_H
-    r = poll (pollfds, nfds, 15000);
+    r = poll (pollfds, nfds, 25000);
     for (i = 0; i<nfds; i++)
     {
         ZOOM_connection c = poll_cs[i];