From: Adam Dickmeiss Date: Fri, 18 Jun 2010 08:37:56 +0000 (+0200) Subject: Add ZOOM_resultset_release X-Git-Tag: v4.0.10~3 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=cabcc9b01684fb0410d4323399262563c6e9dc83;p=yaz-moved-to-github.git Add ZOOM_resultset_release ZOOM_resultset_release releases a result set from a connection. The result set will be on its own thereafter; no operations on it will perform retrievals from a target. Only cached copies are returned. --- diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index 14247a3..668ff84 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -170,6 +170,14 @@ ZOOM_connection_search_pqf(ZOOM_connection c, const char *q); ZOOM_API(void) ZOOM_resultset_destroy(ZOOM_resultset r); +/** release result set from connection. + + The result will will no longer be able to perform retrievals + from the connection from which it was created. +*/ +ZOOM_API(void) +ZOOM_resultset_release(ZOOM_resultset r); + /* result set option */ ZOOM_API(const char *) ZOOM_resultset_option_get(ZOOM_resultset r, const char *key); diff --git a/src/zoom-c.c b/src/zoom-c.c index dd1698c..d79e4e2 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -793,6 +793,29 @@ ZOOM_API(int) static zoom_ret do_write(ZOOM_connection c); +ZOOM_API(void) ZOOM_resultset_release(ZOOM_resultset r) +{ +#if ZOOM_RESULT_LISTS +#else + if (r->connection) + { + /* remove ourselves from the resultsets in connection */ + ZOOM_resultset *rp = &r->connection->resultsets; + while (1) + { + assert(*rp); /* we must be in this list!! */ + if (*rp == r) + { /* OK, we're here - take us out of it */ + *rp = (*rp)->next; + break; + } + rp = &(*rp)->next; + } + r->connection = 0; + } +#endif +} + ZOOM_API(void) ZOOM_connection_destroy(ZOOM_connection c) { @@ -1102,24 +1125,7 @@ static void resultset_destroy(ZOOM_resultset r) yaz_log(log_details, "%p ZOOM_connection resultset_destroy: Deleting resultset (%p) ", r->connection, r); ZOOM_resultset_cache_reset(r); -#if ZOOM_RESULT_LISTS -#else - if (r->connection) - { - /* remove ourselves from the resultsets in connection */ - ZOOM_resultset *rp = &r->connection->resultsets; - while (1) - { - assert(*rp); /* we must be in this list!! */ - if (*rp == r) - { /* OK, we're here - take us out of it */ - *rp = (*rp)->next; - break; - } - rp = &(*rp)->next; - } - } -#endif + ZOOM_resultset_release(r); ZOOM_query_destroy(r->query); ZOOM_options_destroy(r->options); odr_destroy(r->odr);