diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-11-02 17:51:42 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-11-02 17:51:42 +0100 |
commit | a51517f64c83c23545ebd8a935baa311f0de635a (patch) | |
tree | 8431dcad0c9aa743468b551828be021a1378f4a6 /src/auditordb/pg_get_purse_summary.c | |
parent | 5c0b8e32406a7e000396003e9428a1cf9af3e919 (diff) | |
download | exchange-a51517f64c83c23545ebd8a935baa311f0de635a.tar.xz |
-implement missing functions
Diffstat (limited to 'src/auditordb/pg_get_purse_summary.c')
-rw-r--r-- | src/auditordb/pg_get_purse_summary.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/auditordb/pg_get_purse_summary.c b/src/auditordb/pg_get_purse_summary.c index 5a5e087dd..1c5e8a36f 100644 --- a/src/auditordb/pg_get_purse_summary.c +++ b/src/auditordb/pg_get_purse_summary.c @@ -25,9 +25,35 @@ #include "pg_get_purse_summary.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TAH_PG_get_purse_summary (void *cls, const struct TALER_MasterPublicKeyP *master_pub, struct TALER_AUDITORDB_PurseBalance *sum) { + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (master_pub), + GNUNET_PQ_query_param_end + }; + struct GNUNET_PQ_ResultSpec rs[] = { + TALER_PQ_RESULT_SPEC_AMOUNT ("balance", + &sum->balance), + GNUNET_PQ_result_spec_uint64 ("open_purses", + &sum->open_purses), + GNUNET_PQ_result_spec_end + }; + + PREPARE (pg, + "auditor_get_purse_summary", + "SELECT" + " open_purses" + ",balance_val" + ",balance_frac" + " FROM auditor_purse_summary" + " WHERE master_pub=$1;"); + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + "auditor_get_purse_summary", + params, + rs); } |