summaryrefslogtreecommitdiff
path: root/src/auditordb/pg_get_purse_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditordb/pg_get_purse_info.c')
-rw-r--r--src/auditordb/pg_get_purse_info.c29
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);
}