db: enforce that bindings be done in order.

This is almost always true already; fix up the few non-standard ones.

This is enforced with an assert, and I ran the entire test suite to
double-check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-14 09:58:45 +09:30
parent d17506b899
commit b7b3cbc84a
5 changed files with 35 additions and 25 deletions

View File

@@ -81,6 +81,7 @@ static struct db_stmt *db_prepare_core(struct db *db,
stmt->query = db_query;
stmt->executed = false;
stmt->inner_stmt = NULL;
stmt->bind_pos = -1;
tal_add_destructor(stmt, db_stmt_free);