Mercurial > dovecot > core-2.2
changeset 19316:467695fee373
dict-sql: Fixed async iteration with MySQL and SQLite
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 20 Oct 2015 13:12:24 +0300 |
parents | 0f5e58361c48 |
children | 16ff395c156e |
files | src/lib-dict/dict-sql.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-dict/dict-sql.c Tue Oct 20 00:25:14 2015 +0300 +++ b/src/lib-dict/dict-sql.c Tue Oct 20 13:12:24 2015 +0300 @@ -45,6 +45,7 @@ const struct dict_sql_map *map; unsigned int key_prefix_len, pattern_prefix_len, next_map_idx; unsigned int path_idx, sql_fields_start_idx; + bool synchronous_result; bool failed; }; @@ -616,7 +617,7 @@ { sql_result_ref(result); ctx->result = result; - if (ctx->ctx.async_callback != NULL) + if (ctx->ctx.async_callback != NULL && !ctx->synchronous_result) ctx->ctx.async_callback(ctx->ctx.async_context); } @@ -638,8 +639,10 @@ ctx->result = sql_query_s(dict->db, str_c(query)); } else { i_assert(ctx->result == NULL); + ctx->synchronous_result = TRUE; sql_query(dict->db, str_c(query), sql_dict_iterate_callback, ctx); + ctx->synchronous_result = FALSE; } } T_END; *error_r = t_strdup(error);