Towards 1.3.15
[idzebra-moved-to-github.git] / index / zebraapi.c
index 3b62367..f90d3f9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.111 2003-07-07 13:55:37 pop Exp $
+/* $Id: zebraapi.c,v 1.115 2003-11-28 14:47:45 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
    Index Data Aps
 
@@ -20,8 +20,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-
-
 #include <assert.h>
 #include <stdio.h>
 #ifdef WIN32
@@ -186,6 +184,13 @@ ZebraService zebra_start (const char *configName)
     return 0;
 }
 
+
+void zebra_pidfname(ZebraService zs, char *path)
+{
+    zebra_lock_prefix (zs->global_res, path);
+    strcat(path, "zebrasrv.pid");
+}
+
 static
 struct zebra_register *zebra_register_open (ZebraService zs, const char *name,
                                             int rw, int useshadow, Res res,
@@ -1130,6 +1135,7 @@ static int delete_SU_handle(void *handle, int ord)
 
 int zebra_drop_database  (ZebraHandle zh, const char *database)
 {
+    int ret = 0;
     ASSERTZH;
     yaz_log(LOG_API,"zebra_drop_database");
     zh->errCode = 0;
@@ -1145,8 +1151,13 @@ int zebra_drop_database  (ZebraHandle zh, const char *database)
        zebraExplain_trav_ord(zh->reg->zei, zh, delete_SU_handle);
        zebraExplain_removeDatabase(zh->reg->zei, zh);
     }
+    else
+    {
+       yaz_log(LOG_WARN, "drop database only supported for isam:b");
+       ret = -1;
+    }
     zebra_end_trans (zh);
-    return 0;
+    return ret;
 }
 
 int zebra_create_database (ZebraHandle zh, const char *database)
@@ -1253,7 +1264,6 @@ int zebra_end_read (ZebraHandle zh)
 
 int zebra_begin_trans (ZebraHandle zh, int rw)
 {
-    yaz_log(LOG_LOG, "zebra_begin_trans rw=%d trans=%d", rw, zh->trans_no);
     if (!zh->res)
     {
         zh->errCode = 2;
@@ -1424,7 +1434,10 @@ int zebra_begin_trans (ZebraHandle zh, int rw)
             zebra_lock_r (zh->lock_normal);
         
         if (zh->reg)
+       {
+            resultSetInvalidate (zh);
             zebra_register_close (zh->service, zh->reg);
+       }
         zh->reg = zebra_register_open (zh->service, zh->reg_name,
                                        0, val == 'c' ? 1 : 0,
                                        zh->res, zh->path_reg);
@@ -2107,7 +2120,7 @@ int zebra_search_PQF (ZebraHandle zh, const char *pqf_query,
     
     odr_destroy(odr);
 
-    yaz_log(LOG_API,"Hits: %d",numhits);
+    yaz_log(LOG_API,"Hits: %d",hits);
 
     if (numhits)
        *numhits=hits;