We expect min changes (ie. BEGIN TRANSACTION): report if more. * Optionally add "final" at the end (ie. COMMIT). */
| 214 | /* We expect min changes (ie. BEGIN TRANSACTION): report if more. |
| 215 | * Optionally add "final" at the end (ie. COMMIT). */ |
| 216 | void db_report_changes(struct db *db, const char *final, size_t min) |
| 217 | { |
| 218 | assert(db->changes); |
| 219 | assert(tal_count(db->changes) >= min); |
| 220 | |
| 221 | /* Having changes implies that we have a dirty TX. The opposite is |
| 222 | * currently not true, e.g., the postgres driver doesn't record |
| 223 | * changes yet. */ |
| 224 | assert(!tal_count(db->changes) || db->dirty); |
| 225 | |
| 226 | if (tal_count(db->changes) > min && db->report_changes_fn) |
| 227 | db->report_changes_fn(db); |
| 228 | db->changes = tal_free(db->changes); |
| 229 | } |
| 230 | |
| 231 | void db_changes_add(struct db_stmt *stmt, const char * expanded) |
| 232 | { |
no test coverage detected