summaryrefslogtreecommitdiff
path: root/src/auditordb/pg_get_denomination_pending.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditordb/pg_get_denomination_pending.c')
-rw-r--r--src/auditordb/pg_get_denomination_pending.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/auditordb/pg_get_denomination_pending.c b/src/auditordb/pg_get_denomination_pending.c
index e7b82fe9b..a4b01d78f 100644
--- a/src/auditordb/pg_get_denomination_pending.c
+++ b/src/auditordb/pg_get_denomination_pending.c
@@ -1,6 +1,3 @@
-
-
-
/*
This file is part of TALER
Copyright (C) 2024 Taler Systems SA
@@ -63,8 +60,8 @@ struct DenominationPendingContext
*/
static void
denomination_pending_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
+ PGresult *result,
+ unsigned int num_results)
{
struct DenominationPendingContext *dcc = cls;
struct PostgresClosure *pg = dcc->pg;
@@ -79,13 +76,14 @@ denomination_pending_cb (void *cls,
GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id),
- GNUNET_PQ_result_spec_auto_from_type("denom_pub_hash", &dc.denom_pub_hash),
-TALER_PQ_RESULT_SPEC_AMOUNT("denom_balance", &dc.denom_balance),
-TALER_PQ_RESULT_SPEC_AMOUNT("denom_loss", &dc.denom_loss),
-GNUNET_PQ_result_spec_int64("num_issued", &dc.num_issued),
-TALER_PQ_RESULT_SPEC_AMOUNT("denom_risk", &dc.denom_risk),
-TALER_PQ_RESULT_SPEC_AMOUNT("recoup_loss", &dc.recoup_loss),
-GNUNET_PQ_result_spec_bool("suppressed", &dc.suppressed),
+ GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
+ &dc.denom_pub_hash),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("denom_balance", &dc.denom_balance),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", &dc.denom_loss),
+ GNUNET_PQ_result_spec_int64 ("num_issued", &dc.num_issued),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", &dc.denom_risk),
+ TALER_PQ_RESULT_SPEC_AMOUNT ("recoup_loss", &dc.recoup_loss),
+ GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed),
GNUNET_PQ_result_spec_end
@@ -123,12 +121,12 @@ TAH_PG_get_denomination_pending (
TALER_AUDITORDB_DenominationPendingCallback 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 DenominationPendingContext dcc = {
@@ -141,13 +139,14 @@ TAH_PG_get_denomination_pending (
PREPARE (pg,
"auditor_denomination_pending_get_desc",
"SELECT"
+ " row_id, "
" denom_pub_hash,"
-" denom_balance,"
-" denom_loss,"
-" num_issued,"
-" denom_risk,"
-" recoup_loss,"
-" suppressed"
+ " denom_balance,"
+ " denom_loss,"
+ " num_issued,"
+ " denom_risk,"
+ " recoup_loss,"
+ " suppressed"
" FROM auditor_denomination_pending"
" WHERE (row_id < $1)"
" AND ($2 OR suppressed is false)"
@@ -157,13 +156,14 @@ TAH_PG_get_denomination_pending (
PREPARE (pg,
"auditor_denomination_pending_get_asc",
"SELECT"
+ " row_id, "
" denom_pub_hash,"
-" denom_balance,"
-" denom_loss,"
-" num_issued,"
-" denom_risk,"
-" recoup_loss,"
-" suppressed"
+ " denom_balance,"
+ " denom_loss,"
+ " num_issued,"
+ " denom_risk,"
+ " recoup_loss,"
+ " suppressed"
" FROM auditor_denomination_pending"
" WHERE (row_id > $1)"
" AND ($2 OR suppressed is false)"
@@ -172,8 +172,10 @@ TAH_PG_get_denomination_pending (
);
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
(limit > 0)
- ? "auditor_denomination_pending_get_asc"
- : "auditor_denomination_pending_get_desc",
+ ?
+ "auditor_denomination_pending_get_asc"
+ :
+ "auditor_denomination_pending_get_desc",
params,
&denomination_pending_cb,
&dcc);
@@ -183,6 +185,3 @@ TAH_PG_get_denomination_pending (
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs);
return qs;
}
-
-
- \ No newline at end of file