From: Timo Sirainen Date: Mon, 17 Jul 2017 14:54:36 +0000 (+0300) Subject: dict-sql: Add support for sql_result_more() X-Git-Tag: 2.2.32.rc1~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb97e85f9f1caa7a1083755562208b186b0ae747;p=thirdparty%2Fdovecot%2Fcore.git dict-sql: Add support for sql_result_more() --- diff --git a/src/lib-dict/dict-sql.c b/src/lib-dict/dict-sql.c index 03f9ea70a7..08e0e1ad82 100644 --- a/src/lib-dict/dict-sql.c +++ b/src/lib-dict/dict-sql.c @@ -731,6 +731,21 @@ static bool sql_dict_iterate(struct dict_iterate_context *_ctx, } ret = sql_result_next_row(ctx->result); + while (ret == SQL_RESULT_NEXT_MORE) { + if ((ctx->flags & DICT_ITERATE_FLAG_ASYNC) == 0) + sql_result_more_s(&ctx->result); + else { + /* get more results asynchronously */ + ctx->synchronous_result = TRUE; + sql_result_more(&ctx->result, sql_dict_iterate_callback, ctx); + ctx->synchronous_result = FALSE; + if (ctx->result == NULL) { + _ctx->has_more = TRUE; + return FALSE; + } + } + ret = sql_result_next_row(ctx->result); + } if (ret == 0) { /* see if there are more results in the next map. don't do it if we're looking for an exact match, since we