commit 9c8891a5120e9299ab06c73b8778a0b50537b904
parent 82f455ad02909f62f168fc3ce7aecc33e2159a84
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 13 Jan 2024 23:32:03 +0100
improve deletion status code
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/backenddb/pg_delete_order.c b/src/backenddb/pg_delete_order.c
@@ -46,6 +46,7 @@ TMH_PG_delete_order (void *cls,
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
+ enum GNUNET_DB_QueryStatus qs2;
check_connection (pg);
PREPARE (pg,
@@ -69,7 +70,7 @@ TMH_PG_delete_order (void *cls,
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"delete_order",
params);
- if ( (qs <= 0) || (! force))
+ if ( (qs < 0) || (! force) )
return qs;
PREPARE (pg,
"delete_contract",
@@ -81,7 +82,12 @@ TMH_PG_delete_order (void *cls,
" FROM merchant_instances"
" WHERE merchant_id=$1)"
" AND NOT paid;");
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "delete_contract",
- params2);
+ qs2 = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "delete_contract",
+ params2);
+ if (qs2 < 0)
+ return qs2;
+ if (qs2 > 0)
+ return qs2;
+ return qs;
}