commit 77033e3b412709ed30a9ed7baecff8416b697dd8
parent 2da4e542901630c08bcc804dee1ca1a1e0995617
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Fri, 17 Jul 2026 19:39:41 +0200
-handle DB failure correctly
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/donaudb/iterate_donation_units.c b/src/donaudb/iterate_donation_units.c
@@ -46,6 +46,11 @@ struct IterateDonationUnitsContext
*/
struct DONAUDB_PostgresContext *ctx;
+ /**
+ * Set to #GNUNET_SYSERR if extracting a row failed.
+ */
+ enum GNUNET_GenericReturnValue status;
+
};
/**
@@ -89,6 +94,7 @@ iterate_donation_units_cb (void *cls,
i))
{
GNUNET_break (0);
+ ictx->status = GNUNET_SYSERR;
return;
}
@@ -115,7 +121,8 @@ DONAUDB_iterate_donation_units (struct DONAUDB_PostgresContext *ctx,
struct IterateDonationUnitsContext ictx = {
.cb = cb,
.cb_cls = cb_cls,
- .ctx = ctx
+ .ctx = ctx,
+ .status = GNUNET_OK
};
PREPARE (ctx,
@@ -126,9 +133,16 @@ DONAUDB_iterate_donation_units (struct DONAUDB_PostgresContext *ctx,
",validity_year"
",value"
" FROM donation_units");
- return GNUNET_PQ_eval_prepared_multi_select (ctx->conn,
+ {
+ enum GNUNET_DB_QueryStatus qs;
+
+ qs = GNUNET_PQ_eval_prepared_multi_select (ctx->conn,
"iterate_donation_units",
params,
&iterate_donation_units_cb,
&ictx);
+ if (GNUNET_OK != ictx.status)
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ return qs;
+ }
}