dovecot-1.1: dict-sql: Log SQL errors if we see them.

dovecot at dovecot.org dovecot at dovecot.org
Sun Aug 31 09:02:51 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/81d95749dd3b
changeset: 7849:81d95749dd3b
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Aug 31 09:02:46 2008 +0300
description:
dict-sql: Log SQL errors if we see them.

diffstat:

1 file changed, 12 insertions(+), 3 deletions(-)
src/lib-dict/dict-sql.c |   15 ++++++++++++---

diffs (34 lines):

diff -r 83abb0ea6109 -r 81d95749dd3b src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Sat Aug 30 15:24:38 2008 +0300
+++ b/src/lib-dict/dict-sql.c	Sun Aug 31 09:02:46 2008 +0300
@@ -200,9 +200,13 @@ static int sql_dict_lookup(struct dict *
 	} T_END;
 
 	ret = sql_result_next_row(result);
-	if (ret <= 0)
+	if (ret <= 0) {
+		if (ret < 0) {
+			i_error("dict sql lookup failed: %s",
+				sql_result_get_error(result));
+		}
 		*value_r = NULL;
-	else {
+	} else {
 		*value_r =
 			p_strdup(pool, sql_result_get_field_value(result, 0));
 	}
@@ -283,8 +287,13 @@ static int sql_dict_iterate(struct dict_
 	if (ctx->result == NULL)
 		return -1;
 
-	if ((ret = sql_result_next_row(ctx->result)) <= 0)
+	if ((ret = sql_result_next_row(ctx->result)) <= 0) {
+		if (ret < 0) {
+			i_error("dict sql iterate failed: %s",
+				sql_result_get_error(ctx->result));
+		}
 		return ret;
+	}
 
 	key = sql_result_get_field_value(ctx->result, 0);
 	i_free(ctx->prev_key);


More information about the dovecot-cvs mailing list