From: Adam Dickmeiss Date: Mon, 28 Apr 2003 11:04:51 +0000 (+0000) Subject: New ZOOM events ZOOM_EVENT_RECV_{RECORD,SEARCH} for receiving a record X-Git-Tag: YAZ.2.0.2~2 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=3b10b3e056bb684b8f33123a79410f771adbee0a;p=yaz-moved-to-github.git New ZOOM events ZOOM_EVENT_RECV_{RECORD,SEARCH} for receiving a record and search result respectively. --- diff --git a/CHANGELOG b/CHANGELOG index c3ed701..0e60dbb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ Possible compatibility problems with earlier versions marked with '*'. +New ZOOM events ZOOM_EVENT_RECV_{RECORD,SEARCH} for receiving a record +and search result respectively. + --- 2.0.1 2003/04/25 Redhat package is now several packages: libyaz (runtime libraries), diff --git a/debian/changelog b/debian/changelog index e90f1af..4e88286 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +yaz (2.0.1-2) unstable; urgency=low + + * Event extensions. + + -- Adam Dickmeiss Mon, 28 Apr 2003 12:22:50 +0100 + yaz (2.0.1-1) unstable; urgency=low * Upstream. diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index c5bca0e..f9329c1 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -1,6 +1,6 @@ /* * Public header for ZOOM C. - * $Id: zoom.h,v 1.17 2003-02-17 14:35:42 adam Exp $ + * $Id: zoom.h,v 1.18 2003-04-28 11:04:52 adam Exp $ */ #include @@ -106,6 +106,8 @@ ZOOM_connection_last_event(ZOOM_connection cs); #define ZOOM_EVENT_UNKNOWN 5 #define ZOOM_EVENT_SEND_APDU 6 #define ZOOM_EVENT_RECV_APDU 7 +#define ZOOM_EVENT_RECV_RECORD 8 +#define ZOOM_EVENT_RECV_SEARCH 9 /* ----------------------------------------------------------- */ /* result sets */ diff --git a/zutil/zoom-c.c b/zutil/zoom-c.c index 377c2b5..7ce62e7 100644 --- a/zutil/zoom-c.c +++ b/zutil/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (c) 2000-2003, Index Data * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.31 2003-04-23 20:38:19 adam Exp $ + * $Id: zoom-c.c,v 1.32 2003-04-28 11:04:52 adam Exp $ * * ZOOM layer for C, connections, result sets, queries. */ @@ -172,6 +172,7 @@ void ZOOM_connection_remove_task (ZOOM_connection c) switch (task->which) { case ZOOM_TASK_SEARCH: + ZOOM_resultset_destroy (task->u.search.resultset); break; case ZOOM_TASK_RETRIEVE: @@ -1307,8 +1308,14 @@ ZOOM_resultset_record_immediate (ZOOM_resultset s,size_t pos) ZOOM_API(ZOOM_record) ZOOM_resultset_record (ZOOM_resultset r, size_t pos) { - ZOOM_resultset_retrieve (r, 1, pos, 1); - return ZOOM_resultset_record_immediate (r, pos); + ZOOM_record rec = ZOOM_resultset_record_immediate(r, pos); + + if (!rec) + { + ZOOM_resultset_retrieve (r, 1, pos, 1); + rec = ZOOM_resultset_record_immediate (r, pos); + } + return rec; } ZOOM_API(void) @@ -1526,6 +1533,9 @@ static void record_cache_add (ZOOM_resultset r, Z_NamePlusRecord *npr, const char *syntax = ZOOM_resultset_option_get (r, "preferredRecordSyntax"); + ZOOM_Event event = ZOOM_Event_create(ZOOM_EVENT_RECV_RECORD); + ZOOM_connection_put_event(r->connection, event); + for (rc = r->record_cache; rc; rc = rc->next) { if (pos == rc->pos) @@ -1665,11 +1675,15 @@ static void handle_present_response (ZOOM_connection c, Z_PresentResponse *pr) static void handle_search_response (ZOOM_connection c, Z_SearchResponse *sr) { ZOOM_resultset resultset; - + ZOOM_Event event; + yaz_log (LOG_DEBUG, "got search response"); - + if (!c->tasks || c->tasks->which != ZOOM_TASK_SEARCH) return ; + + event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH); + ZOOM_connection_put_event(c, event); resultset = c->tasks->u.search.resultset; @@ -2449,6 +2463,7 @@ static void handle_srw_response(ZOOM_connection c, ZOOM_resultset resultset = 0; int i; NMEM nmem; + ZOOM_Event event; if (!c->tasks) return; @@ -2460,6 +2475,9 @@ static void handle_srw_response(ZOOM_connection c, else return ; + event = ZOOM_Event_create(ZOOM_EVENT_RECV_SEARCH); + ZOOM_connection_put_event(c, event); + resultset->size = 0; yaz_log(LOG_DEBUG, "got SRW response OK");