]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-sql: Add support for sql_result_more()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 17 Jul 2017 14:54:36 +0000 (17:54 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 18 Jul 2017 12:15:25 +0000 (15:15 +0300)
src/lib-dict/dict-sql.c

index 03f9ea70a7eb378b1045279bac638a3aef37fe4a..08e0e1ad82ccbf37b832a88637d75e36ac144126 100644 (file)
@@ -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