commit 7f2e349a37bef5b42e8743c3a3a06acdd3175a3a
parent 9825912290ea866bfc1c7fd38430ca527af00ca0
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sun, 16 Aug 2026 23:26:52 +0200
abort iteration on failure
Diffstat:
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/exchangedb/iterate_reserve_close_info.c b/src/exchangedb/iterate_reserve_close_info.c
@@ -41,6 +41,11 @@ struct IteratorContext
* Plugin context.
*/
struct TALER_EXCHANGEDB_PostgresContext *pg;
+
+ /**
+ * Flag set to #GNUNET_OK as long as everything is fine.
+ */
+ enum GNUNET_GenericReturnValue status;
};
@@ -71,6 +76,7 @@ iterate_reserve_close_info_cb (void *cls,
&amount),
GNUNET_PQ_result_spec_end
};
+ enum GNUNET_GenericReturnValue ret;
if (GNUNET_OK !=
GNUNET_PQ_extract_result (result,
@@ -78,11 +84,23 @@ iterate_reserve_close_info_cb (void *cls,
i))
{
GNUNET_break (0);
+ ic->status = GNUNET_SYSERR;
return;
}
- ic->cb (ic->cb_cls,
- &amount,
- ts);
+ ret = ic->cb (ic->cb_cls,
+ &amount,
+ ts);
+ switch (ret)
+ {
+ case GNUNET_OK:
+ continue;
+ case GNUNET_NO:
+ break;
+ case GNUNET_SYSERR:
+ ic->status = GNUNET_SYSERR;
+ break;
+ }
+ break;
}
}
@@ -103,8 +121,10 @@ TALER_EXCHANGEDB_iterate_reserve_close_info (
struct IteratorContext ic = {
.cb = kac,
.cb_cls = kac_cls,
- .pg = pg
+ .pg = pg,
+ .status = GNUNET_OK
};
+ enum GNUNET_DB_QueryStatus qs;
PREPARE (pg,
"iterate_reserve_close_info",
@@ -118,10 +138,13 @@ TALER_EXCHANGEDB_iterate_reserve_close_info (
" )"
" AND execution_date >= $2"
" ORDER BY execution_date DESC");
- return GNUNET_PQ_eval_prepared_multi_select (
+ qs = GNUNET_PQ_eval_prepared_multi_select (
pg->conn,
"iterate_reserve_close_info",
params,
&iterate_reserve_close_info_cb,
&ic);
+ if (GNUNET_OK != ic.status)
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ return qs;
}