dovecot-2.0: mysql: Fixed assert-crashing on transaction commits.
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 20 20:49:45 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/1e45b463b93a
changeset: 11359:1e45b463b93a
user: Timo Sirainen <tss at iki.fi>
date: Thu May 20 19:49:41 2010 +0200
description:
mysql: Fixed assert-crashing on transaction commits.
diffstat:
src/lib-sql/driver-mysql.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diffs (49 lines):
diff -r b715f1e39f25 -r 1e45b463b93a src/lib-sql/driver-mysql.c
--- a/src/lib-sql/driver-mysql.c Thu May 20 18:28:04 2010 +0200
+++ b/src/lib-sql/driver-mysql.c Thu May 20 19:49:41 2010 +0200
@@ -459,8 +459,9 @@
callback(NULL, context);
}
-static int transaction_send_query(struct mysql_transaction_context *ctx,
- const char *query)
+static int
+transaction_send_query(struct mysql_transaction_context *ctx, const char *query,
+ unsigned int *affected_rows_r)
{
struct sql_result *result;
my_ulonglong rows;
@@ -474,13 +475,12 @@
ctx->error = sql_result_get_error(result);
ctx->failed = TRUE;
ret = -1;
- } else if (ctx->ctx.head != NULL &&
- ctx->ctx.head->affected_rows != NULL) {
+ } else if (affected_rows_r != NULL) {
struct mysql_db *db = (struct mysql_db *)result->db;
rows = mysql_affected_rows(db->mysql);
i_assert(rows != (my_ulonglong)-1);
- *ctx->ctx.head->affected_rows = rows;
+ *affected_rows_r = rows;
}
sql_result_unref(result);
return ret;
@@ -499,13 +499,14 @@
if (_ctx->head != NULL) {
/* try to use a transaction in any case,
even if it doesn't work. */
- (void)transaction_send_query(ctx, "BEGIN");
+ (void)transaction_send_query(ctx, "BEGIN", NULL);
while (_ctx->head != NULL) {
- if (transaction_send_query(ctx, _ctx->head->query) < 0)
+ if (transaction_send_query(ctx, _ctx->head->query,
+ _ctx->head->affected_rows) < 0)
break;
_ctx->head = _ctx->head->next;
}
- ret = transaction_send_query(ctx, "COMMIT");
+ ret = transaction_send_query(ctx, "COMMIT", NULL);
*error_r = ctx->error;
}
sql_transaction_rollback(&_ctx);
More information about the dovecot-cvs
mailing list