From 4270014e02ecefd22618badf185607a3120d46b7 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Tue, 4 Sep 2018 20:30:12 +0300 Subject: [PATCH] driver-sqlite: Document why rollback is called when commit fails --- src/lib-sql/driver-sqlite.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib-sql/driver-sqlite.c b/src/lib-sql/driver-sqlite.c index 2cc3522858..819c61d254 100644 --- a/src/lib-sql/driver-sqlite.c +++ b/src/lib-sql/driver-sqlite.c @@ -400,7 +400,12 @@ driver_sqlite_transaction_commit(struct sql_transaction_context *_ctx, e_debug(sql_transaction_finished_event(_ctx)-> add_str("error", commit_result.error)->event(), "Transaction failed"); - /* also does i_free(ctx) */ + /* From SQLite manual: It is recommended that applications + respond to the errors listed above by explicitly issuing a + ROLLBACK command. If the transaction has already been rolled + back automatically by the error response, then the ROLLBACK + command will fail with an error, but no harm is caused by + this. */ driver_sqlite_transaction_rollback(_ctx); } else { e_debug(sql_transaction_finished_event(_ctx)->event(), -- 2.47.3