db: catch SQL errors unless we're expecting them.

I couldn't figure out why my new SQL query was returning 0 rows,
and it was because we were ignoring errors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-04-05 12:30:23 +09:30
parent d2176e3385
commit 9bcf28afb3
4 changed files with 21 additions and 9 deletions

View File

@@ -49,7 +49,12 @@ bool db_exec_prepared_v2(struct db_stmt *stmt TAKES);
*
* @stmt: The prepared statement to execute
*/
bool db_query_prepared(struct db_stmt *stmt);
void db_query_prepared(struct db_stmt *stmt);
/**
* Variation which allows failure.
*/
bool db_query_prepared_canfail(struct db_stmt *stmt);
size_t db_count_changes(struct db_stmt *stmt);
void db_report_changes(struct db *db, const char *final, size_t min);