dovecot-2.2: pgsql: Fixed committing a single sql_update_get_row...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Sep 23 22:05:24 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/beb3b8496b7d
changeset: 19204:beb3b8496b7d
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 24 01:04:00 2015 +0300
description:
pgsql: Fixed committing a single sql_update_get_rows() transaction.
The rows weren't being set.
diffstat:
src/lib-sql/driver-pgsql.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diffs (43 lines):
diff -r 9ceeb1a5c492 -r beb3b8496b7d src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c Thu Sep 24 01:02:32 2015 +0300
+++ b/src/lib-sql/driver-pgsql.c Thu Sep 24 01:04:00 2015 +0300
@@ -950,6 +950,30 @@
}
static void
+transaction_trans_query_callback(struct sql_result *result,
+ struct sql_transaction_query *query)
+{
+ struct pgsql_transaction_context *ctx =
+ (struct pgsql_transaction_context *)query->trans;
+
+ if (sql_result_next_row(result) < 0) {
+ ctx->callback(sql_result_get_error(result), ctx->context);
+ driver_pgsql_transaction_free(ctx);
+ return;
+ }
+
+ if (query->affected_rows != NULL) {
+ struct pgsql_result *pg_result = (struct pgsql_result *)result;
+
+ if (str_to_uint(PQcmdTuples(pg_result->pgres),
+ query->affected_rows) < 0)
+ i_unreached();
+ }
+ ctx->callback(NULL, ctx->context);
+ driver_pgsql_transaction_free(ctx);
+}
+
+static void
driver_pgsql_transaction_commit(struct sql_transaction_context *_ctx,
sql_commit_callback_t *callback, void *context)
{
@@ -965,7 +989,7 @@
} else if (_ctx->head->next == NULL) {
/* just a single query, send it */
sql_query(_ctx->db, _ctx->head->query,
- transaction_commit_callback, ctx);
+ transaction_trans_query_callback, _ctx->head);
} else {
/* multiple queries, use a transaction */
i_assert(_ctx->db->v.query == driver_pgsql_query);
More information about the dovecot-cvs
mailing list