dovecot-2.2: dict-sql: Fixed iteration with DICT_ITERATE_FLAG_NO...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 2 16:39:34 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/7ccff6d5dd1b
changeset: 19069:7ccff6d5dd1b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 02 19:38:35 2015 +0300
description:
dict-sql: Fixed iteration with DICT_ITERATE_FLAG_NO_VALUE

diffstat:

 src/lib-dict/dict-sql.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 54c4e1ed387a -r 7ccff6d5dd1b src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Wed Sep 02 18:42:01 2015 +0300
+++ b/src/lib-dict/dict-sql.c	Wed Sep 02 19:38:35 2015 +0300
@@ -573,7 +573,7 @@
 		str_append_c(ctx->key, '/');
 
 	count = sql_result_get_fields_count(ctx->result);
-	i = 1;
+	i = (ctx->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0 ? 0 : 1;
 	for (p = ctx->map->pattern + ctx->pattern_prefix_len; *p != '\0'; p++) {
 		if (*p != '$')
 			str_append_c(ctx->key, *p);
@@ -587,7 +587,10 @@
 	}
 
 	*key_r = str_c(ctx->key);
-	*value_r = sql_result_get_field_value(ctx->result, 0);
+	if ((ctx->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0)
+		*value_r = "";
+	else
+		*value_r = sql_result_get_field_value(ctx->result, 0);
 	return TRUE;
 }
 


More information about the dovecot-cvs mailing list