* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebraapi.c,v $
- * Revision 1.24 1999-10-14 14:33:50 adam
+ * Revision 1.25 1999-11-04 15:00:45 adam
+ * Implemented delete result set(s).
+ *
+ * Revision 1.24 1999/10/14 14:33:50 adam
* Added truncation 5=106.
*
* Revision 1.23 1999/09/07 11:36:32 adam
zebra_chdir (zh);
if (zh->records)
{
- resultSetDestroy (zh);
+ resultSetDestroy (zh, -1, 0, 0);
zebraExplain_close (zh->zei, 0, 0);
dict_close (zh->dict);
sortIdx_close (zh->sortIdx);
zebra_register_unlock (zh);
}
+int zebra_deleleResultSet(ZebraHandle zh, int function,
+ int num_setnames, char **setnames,
+ int *statuses)
+{
+ int i, status;
+ if (zebra_register_lock (zh))
+ return Z_DeleteStatus_systemProblemAtTarget;
+ switch (function)
+ {
+ case Z_DeleteRequest_list:
+ resultSetDestroy (zh, num_setnames, setnames, statuses);
+ break;
+ case Z_DeleteRequest_all:
+ resultSetDestroy (zh, -1, 0, statuses);
+ break;
+ }
+ zebra_register_unlock (zh);
+ status = Z_DeleteStatus_success;
+ for (i = 0; i<num_setnames; i++)
+ if (statuses[i] == Z_DeleteStatus_resultSetDidNotExist)
+ status = statuses[i];
+ return status;
+}
+
int zebra_errCode (ZebraHandle zh)
{
return zh->errCode;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebraapi.h,v $
- * Revision 1.6 1999-02-17 11:29:57 adam
+ * Revision 1.7 1999-11-04 15:00:45 adam
+ * Implemented delete result set(s).
+ *
+ * Revision 1.6 1999/02/17 11:29:57 adam
* Fixed in record_fetch. Minor updates to API.
*
* Revision 1.5 1998/09/22 10:48:19 adam
int *position, int *num_entries,
ZebraScanEntry **list,
int *is_partial);
+
+/* Delete Result Set(s) */
+YAZ_EXPORT int zebra_deleleResultSet(ZebraHandle zh, int function,
+ int num_setnames, char **setnames,
+ int *statuses);
/* Close zebra and destroy handle */
YAZ_EXPORT void zebra_close (ZebraHandle zh);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.72 1999-10-29 10:01:54 adam
- * Minor fix in bend_init where handle wasn't set to NULL when
- * zebra_init fails.
+ * Revision 1.73 1999-11-04 15:00:45 adam
+ * Implemented delete result set(s).
*
* Revision 1.71 1999/07/14 10:59:26 adam
* Changed functions isc_getmethod, isams_getmethod.
#endif
static int bend_sort (void *handle, bend_sort_rr *rr);
+static int bend_delete (void *handle, bend_delete_rr *rr);
bend_initresult *bend_init (bend_initrequest *q)
{
char *user = NULL;
char *passwd = NULL;
- r->handle = 0;
r->errcode = 0;
r->errstring = 0;
q->bend_sort = bend_sort;
+ q->bend_delete = bend_delete;
logf (LOG_DEBUG, "bend_init");
return 0;
}
+int bend_delete (void *handle, bend_delete_rr *rr)
+{
+ ZebraHandle zh = (ZebraHandle) handle;
+
+ rr->delete_status = zebra_deleleResultSet(zh, rr->function,
+ rr->num_setnames, rr->setnames,
+ rr->statuses);
+ return 0;
+}
+
#ifndef WIN32
static void bend_start (struct statserv_options_block *sob)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.43 1999-07-14 10:59:27 adam
+ * Revision 1.44 1999-11-04 15:00:45 adam
+ * Implemented delete result set(s).
+ *
+ * Revision 1.43 1999/07/14 10:59:27 adam
* Changed functions isc_getmethod, isams_getmethod.
* Improved fatal error handling (such as missing EXPLAIN schema).
*
ZebraSet resultSetAddRPN (ZebraHandle zh, ODR stream, ODR decode, Z_RPNQuery *rpn, int num_bases, char **basenames,
const char *setname);
RSET resultSetRef (ZebraHandle zh, Z_ResultSetId *resultSetId);
-void resultSetDestroy (ZebraHandle zh);
+void resultSetDestroy (ZebraHandle zh, int num_names, char **names,
+ int *statuses);
ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name,
int num, int *positions);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zsets.c,v $
- * Revision 1.23 1999-05-26 07:49:13 adam
+ * Revision 1.24 1999-11-04 15:00:45 adam
+ * Implemented delete result set(s).
+ *
+ * Revision 1.23 1999/05/26 07:49:13 adam
* C++ compilation.
*
* Revision 1.22 1999/02/02 14:51:15 adam
return NULL;
}
-
-void resultSetDestroy (ZebraHandle zh)
+void resultSetDestroy (ZebraHandle zh, int num, char **names,int *statuses)
{
- ZebraSet s, s1;
-
- for (s = zh->sets; s; s = s1)
+ ZebraSet *ss = &zh->sets;
+ int i;
+
+ if (statuses)
+ for (i = 0; i<num; i++)
+ statuses[i] = Z_DeleteStatus_resultSetDidNotExist;
+ zh->errCode = 0;
+ zh->errString = NULL;
+ while (*ss)
{
- s1 = s->next;
-
- xfree (s->sort_info->all_entries);
- xfree (s->sort_info->entries);
- xfree (s->sort_info);
-
- if (s->nmem)
- nmem_destroy (s->nmem);
- rset_delete (s->rset);
- xfree (s->name);
- xfree (s);
+ int i = -1;
+ ZebraSet s = *ss;
+ if (num >= 0)
+ {
+ for (i = 0; i<num; i++)
+ if (!strcmp (s->name, names[i]))
+ {
+ if (statuses)
+ statuses[i] = Z_DeleteStatus_success;
+ i = -1;
+ break;
+ }
+ }
+ if (i < 0)
+ {
+ *ss = s->next;
+
+ xfree (s->sort_info->all_entries);
+ xfree (s->sort_info->entries);
+ xfree (s->sort_info);
+
+ if (s->nmem)
+ nmem_destroy (s->nmem);
+ rset_delete (s->rset);
+ xfree (s->name);
+ xfree (s);
+ }
+ else
+ ss = &s->next;
}
- zh->sets = NULL;
}
ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name,