| 141 | } |
| 142 | |
| 143 | void db_commit_transaction(struct db *db) |
| 144 | { |
| 145 | bool ok; |
| 146 | assert(db->in_transaction); |
| 147 | db_assert_no_outstanding_statements(db); |
| 148 | |
| 149 | /* Increment before reporting changes to an eventual plugin. */ |
| 150 | if (db->dirty) |
| 151 | db_data_version_incr(db); |
| 152 | |
| 153 | db_report_changes(db, NULL, 0); |
| 154 | ok = db->config->commit_tx_fn(db); |
| 155 | |
| 156 | if (!ok) |
| 157 | db_fatal("Failed to commit DB transaction: %s", db->error); |
| 158 | |
| 159 | db->in_transaction = NULL; |
| 160 | db->dirty = false; |
| 161 | } |