exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 3ee4447a653acf5977156391c71e760bd6902bee
parent dadb6cad8050f216cccd6a36aa5fa98d7541f38f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 23 Jun 2024 15:08:45 +0200

implement select_aml_statistics

Diffstat:
Msrc/exchangedb/pg_select_aml_statistics.c | 26+++++++++++++++++++++++++-
Msrc/exchangedb/pg_select_contract_by_purse.c | 2+-
2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/exchangedb/pg_select_aml_statistics.c b/src/exchangedb/pg_select_aml_statistics.c @@ -34,5 +34,29 @@ TEH_PG_select_aml_statistics ( struct GNUNET_TIME_Timestamp end_date, uint64_t *cnt) { - // FIXME! + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_string (name), + GNUNET_PQ_query_param_timestamp (&start_date), + GNUNET_PQ_query_param_timestamp (&end_date), + GNUNET_PQ_query_param_end + }; + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_uint64 ("count", + cnt), + GNUNET_PQ_result_spec_end + }; + + PREPARE (pg, + "select_aml_statistics", + "SELECT " + " COUNT(*) AS count" + " FROM kyc_events" + " WHERE event_type=$1" + " AND event_timestamp >= $1" + " AND event_timestamp < $2;"); + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + "select_aml_statistics", + params, + rs); } diff --git a/src/exchangedb/pg_select_contract_by_purse.c b/src/exchangedb/pg_select_contract_by_purse.c @@ -46,7 +46,7 @@ TEH_PG_select_contract_by_purse ( &econtract->econtract_size), GNUNET_PQ_result_spec_end }; - /* Used in #postgres_select_contract_by_purse */ + PREPARE (pg, "select_contract_by_purse", "SELECT "