changeset 18639:7abdcf42b63b

dict-sql: If DICT_ITERATE_FLAG_EXACT_KEY is used, use only the first found map.
author Timo Sirainen <tss@iki.fi>
date Mon, 11 May 2015 21:48:45 +0300
parents bb7d35fa9b43
children 3725c601dbaf
files src/lib-dict/dict-sql.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-dict/dict-sql.c	Mon May 11 19:12:45 2015 +0300
+++ b/src/lib-dict/dict-sql.c	Mon May 11 21:48:45 2015 +0300
@@ -447,8 +447,11 @@
 	}
 
 	while ((ret = sql_result_next_row(ctx->result)) == 0) {
-		/* see if there are more results in the next map */
-		if (!sql_dict_iterate_next_query(ctx))
+		/* see if there are more results in the next map.
+		   don't do it if we're looking for an exact match, since we
+		   already should have handled it. */
+		if ((ctx->flags & DICT_ITERATE_FLAG_EXACT_KEY) != 0 ||
+		    !sql_dict_iterate_next_query(ctx))
 			return FALSE;
 	}
 	if (ret < 0) {