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_info.c | |
parent | 5c0b8e32406a7e000396003e9428a1cf9af3e919 (diff) | |
download | exchange-a51517f64c83c23545ebd8a935baa311f0de635a.tar.xz |
-implement missing functions
Diffstat (limited to 'src/auditordb/pg_get_purse_info.c')
-rw-r--r-- | src/auditordb/pg_get_purse_info.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/auditordb/pg_get_purse_info.c b/src/auditordb/pg_get_purse_info.c index 4c469978a..aa0f3027d 100644 --- a/src/auditordb/pg_get_purse_info.c +++ b/src/auditordb/pg_get_purse_info.c @@ -34,4 +34,33 @@ TAH_PG_get_purse_info ( struct TALER_Amount *balance, struct GNUNET_TIME_Timestamp *expiration_date) { + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (purse_pub), + 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", + balance), + GNUNET_PQ_result_spec_timestamp ("expiration_date", + expiration_date), + GNUNET_PQ_result_spec_uint64 ("auditor_purses_rowid", + rowid), + GNUNET_PQ_result_spec_end + }; + + PREPARE (pg, + "auditor_get_purse_info", + "SELECT" + " expiration_date" + ",balance_val" + ",balance_frac" + " FROM auditor_purses" + " WHERE purse_pub=$1" + " AND master_pub=$2;"); + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + "auditor_get_purse_info", + params, + rs); } |