summaryrefslogtreecommitdiff
path: root/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c')
-rw-r--r--src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c
index 5e7ac3533..e55aae76b 100644
--- a/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c
+++ b/src/auditordb/pg_get_reserve_balance_summary_wrong_inconsistency.c
@@ -1,6 +1,3 @@
-
-
-
/*
This file is part of TALER
Copyright (C) 2024 Taler Systems SA
@@ -63,8 +60,8 @@ struct ReserveBalanceSummaryWrongInconsistencyContext
*/
static void
reserve_balance_summary_wrong_inconsistency_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
+ PGresult *result,
+ unsigned int num_results)
{
struct ReserveBalanceSummaryWrongInconsistencyContext *dcc = cls;
struct PostgresClosure *pg = dcc->pg;
@@ -79,10 +76,10 @@ reserve_balance_summary_wrong_inconsistency_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id),
- GNUNET_PQ_result_spec_auto_from_type("reserve_pub", &dc.reserve_pub),
-TALER_PQ_RESULT_SPEC_AMOUNT("exchange_amount", &dc.exchange_amount),
-TALER_PQ_RESULT_SPEC_AMOUNT("auditor_amount", &dc.auditor_amount),
-GNUNET_PQ_result_spec_bool("suppressed", &dc.suppressed),
+ GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_amount", &dc.exchange_amount),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("auditor_amount", &dc.auditor_amount),
+ GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed),
GNUNET_PQ_result_spec_end
@@ -120,12 +117,12 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency (
TALER_AUDITORDB_ReserveBalanceSummaryWrongInconsistencyCallback cb,
void *cb_cls)
{
-
+ uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit);
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&offset),
GNUNET_PQ_query_param_bool (return_suppressed),
- GNUNET_PQ_query_param_int64 (&limit),
+ GNUNET_PQ_query_param_uint64 (&plimit),
GNUNET_PQ_query_param_end
};
struct ReserveBalanceSummaryWrongInconsistencyContext dcc = {
@@ -139,10 +136,10 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency (
"auditor_reserve_balance_summary_wrong_inconsistency_get_desc",
"SELECT"
" row_id,"
-" reserve_pub,"
-" exchange_amount,"
-" auditor_amount,"
-" suppressed"
+ " reserve_pub,"
+ " exchange_amount,"
+ " auditor_amount,"
+ " suppressed"
" FROM auditor_reserve_balance_summary_wrong_inconsistency"
" WHERE (row_id < $1)"
" AND ($2 OR suppressed is false)"
@@ -153,10 +150,10 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency (
"auditor_reserve_balance_summary_wrong_inconsistency_get_asc",
"SELECT"
" row_id,"
-" reserve_pub,"
-" exchange_amount,"
-" auditor_amount,"
-" suppressed"
+ " reserve_pub,"
+ " exchange_amount,"
+ " auditor_amount,"
+ " suppressed"
" FROM auditor_reserve_balance_summary_wrong_inconsistency"
" WHERE (row_id > $1)"
" AND ($2 OR suppressed is false)"
@@ -165,10 +162,13 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency (
);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
(limit > 0)
- ? "auditor_reserve_balance_summary_wrong_inconsistency_get_asc"
- : "auditor_reserve_balance_summary_wrong_inconsistency_get_desc",
+ ?
+ "auditor_reserve_balance_summary_wrong_inconsistency_get_asc"
+ :
+ "auditor_reserve_balance_summary_wrong_inconsistency_get_desc",
params,
- &reserve_balance_summary_wrong_inconsistency_cb,
+ &
+ reserve_balance_summary_wrong_inconsistency_cb,
&dcc);
if (qs > 0)
@@ -176,6 +176,3 @@ TAH_PG_get_reserve_balance_summary_wrong_inconsistency (
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
return qs;
}
-
-
- \ No newline at end of file