summaryrefslogtreecommitdiff
path: root/src/auditordb/pg_get_misattribution_in_inconsistency.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditordb/pg_get_misattribution_in_inconsistency.c')
-rw-r--r--src/auditordb/pg_get_misattribution_in_inconsistency.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/auditordb/pg_get_misattribution_in_inconsistency.c b/src/auditordb/pg_get_misattribution_in_inconsistency.c
index a47b11306..f3edf9866 100644
--- a/src/auditordb/pg_get_misattribution_in_inconsistency.c
+++ b/src/auditordb/pg_get_misattribution_in_inconsistency.c
@@ -1,6 +1,3 @@
-
-
-
/*
This file is part of TALER
Copyright (C) 2024 Taler Systems SA
@@ -63,8 +60,8 @@ struct MisattributionInInconsistencyContext
*/
static void
misattribution_in_inconsistency_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
+ PGresult *result,
+ unsigned int num_results)
{
struct MisattributionInInconsistencyContext *dcc = cls;
struct PostgresClosure *pg = dcc->pg;
@@ -79,10 +76,10 @@ misattribution_in_inconsistency_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id),
- TALER_PQ_RESULT_SPEC_AMOUNT("amount", &dc.amount),
-GNUNET_PQ_result_spec_int64("bank_row", &dc.bank_row),
-GNUNET_PQ_result_spec_auto_from_type("reserve_pub", &dc.reserve_pub),
-GNUNET_PQ_result_spec_bool("suppressed", &dc.suppressed),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount),
+ GNUNET_PQ_result_spec_int64 ("bank_row", &dc.bank_row),
+ GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub),
+ GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed),
GNUNET_PQ_result_spec_end
@@ -120,12 +117,12 @@ TAH_PG_get_misattribution_in_inconsistency (
TALER_AUDITORDB_MisattributionInInconsistencyCallback 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 MisattributionInInconsistencyContext dcc = {
@@ -139,10 +136,10 @@ TAH_PG_get_misattribution_in_inconsistency (
"auditor_misattribution_in_inconsistency_get_desc",
"SELECT"
" row_id,"
-" amount,"
-" bank_row,"
-" reserve_pub,"
-" suppressed"
+ " amount,"
+ " bank_row,"
+ " reserve_pub,"
+ " suppressed"
" FROM auditor_misattribution_in_inconsistency"
" WHERE (row_id < $1)"
" AND ($2 OR suppressed is false)"
@@ -153,10 +150,10 @@ TAH_PG_get_misattribution_in_inconsistency (
"auditor_misattribution_in_inconsistency_get_asc",
"SELECT"
" row_id,"
-" amount,"
-" bank_row,"
-" reserve_pub,"
-" suppressed"
+ " amount,"
+ " bank_row,"
+ " reserve_pub,"
+ " suppressed"
" FROM auditor_misattribution_in_inconsistency"
" WHERE (row_id > $1)"
" AND ($2 OR suppressed is false)"
@@ -165,8 +162,10 @@ TAH_PG_get_misattribution_in_inconsistency (
);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
(limit > 0)
- ? "auditor_misattribution_in_inconsistency_get_asc"
- : "auditor_misattribution_in_inconsistency_get_desc",
+ ?
+ "auditor_misattribution_in_inconsistency_get_asc"
+ :
+ "auditor_misattribution_in_inconsistency_get_desc",
params,
&misattribution_in_inconsistency_cb,
&dcc);
@@ -176,6 +175,3 @@ TAH_PG_get_misattribution_in_inconsistency (
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
return qs;
}
-
-
- \ No newline at end of file