From cab4338c5c234466d9746982005b23de99555121 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 23 Jan 2013 12:19:59 +0100 Subject: [PATCH] pz:extendrecs number of records in extended mode If pz:extendrecs is defined it is the maximum number of records for a target for a show that would otherwise be partial. --- src/client.c | 19 ++++++++++++------- src/settings.c | 1 + src/settings.h | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/client.c b/src/client.c index d3265c3..4c40d9c 100644 --- a/src/client.c +++ b/src/client.c @@ -766,16 +766,21 @@ int client_fetch_more(struct client *cl) { struct session_database *sdb = client_get_database(cl); const char *str; - int extra = cl->hits - cl->record_offset; + int extend_recs = 0; + int number; - if (extra > 0) + str = session_setting_oneval(sdb, PZ_EXTENDRECS); + if (str && *str) + extend_recs = atoi(str); + + if (extend_recs > cl->hits) + extend_recs = cl->hits; + + number = extend_recs - cl->record_offset; + if (number > 0) { ZOOM_resultset set = cl->resultset; struct connection *co = client_get_connection(cl); - int max_extra = 10; - - if (extra > max_extra) - extra = max_extra; str = session_setting_oneval(sdb, PZ_REQUESTSYNTAX); ZOOM_resultset_option_set(set, "preferredRecordSyntax", str); @@ -783,7 +788,7 @@ int client_fetch_more(struct client *cl) if (str && *str) ZOOM_resultset_option_set(set, "elementSetName", str); - ZOOM_resultset_records(set, 0, cl->record_offset, extra); + ZOOM_resultset_records(set, 0, cl->record_offset, number); client_set_state(cl, Client_Working); connection_continue(co); return 1; diff --git a/src/settings.c b/src/settings.c index 233125e..d2e15ec 100644 --- a/src/settings.c +++ b/src/settings.c @@ -81,6 +81,7 @@ static char *hard_settings[] = { "pz:sortmap:", "pz:present_chunk", "pz:block_timeout", + "pz:extendrecs", 0 }; diff --git a/src/settings.h b/src/settings.h index f6a33fd..b0da583 100644 --- a/src/settings.h +++ b/src/settings.h @@ -54,7 +54,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define PZ_SORTMAP 31 #define PZ_PRESENT_CHUNK 32 #define PZ_BLOCK_TIMEOUT 33 -#define PZ_MAX_EOF 34 +#define PZ_EXTENDRECS 34 +#define PZ_MAX_EOF 35 struct setting { -- 1.7.10.4