We expect min changes (ie. BEGIN TRANSACTION): report if more. * Optionally add "final" at the end (ie. COMMIT). */
| 228 | /* We expect min changes (ie. BEGIN TRANSACTION): report if more. |
| 229 | * Optionally add "final" at the end (ie. COMMIT). */ |
| 230 | void db_report_changes(struct db *db, const char *final, size_t min) |
| 231 | { |
| 232 | assert(db->changes); |
| 233 | assert(tal_count(db->changes) >= min); |
| 234 | |
| 235 | /* Having changes implies that we have a dirty TX. The opposite is |
| 236 | * currently not true, e.g., the postgres driver doesn't record |
| 237 | * changes yet. */ |
| 238 | assert(!tal_count(db->changes) || db->dirty); |
| 239 | |
| 240 | if (tal_count(db->changes) > min && db->report_changes_fn) |
| 241 | db->report_changes_fn(db); |
| 242 | db->changes = tal_free(db->changes); |
| 243 | } |
| 244 | |
| 245 | void db_changes_add(struct db_stmt *stmt, const char * expanded) |
| 246 | { |
no test coverage detected