From 5de648b0f6f8efba2665dd05cf3b4f45a1ac164b Mon Sep 17 00:00:00 2001 From: Joseph Date: Wed, 11 Jan 2023 05:54:49 -0500 Subject: new functions for inserting into link_data ready_deposit refunds --- src/exchangedb/pg_select_refunds_by_coin.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/exchangedb/pg_select_refunds_by_coin.c') diff --git a/src/exchangedb/pg_select_refunds_by_coin.c b/src/exchangedb/pg_select_refunds_by_coin.c index 84b63a719..b9db2b709 100644 --- a/src/exchangedb/pg_select_refunds_by_coin.c +++ b/src/exchangedb/pg_select_refunds_by_coin.c @@ -140,16 +140,25 @@ TEH_PG_select_refunds_by_coin ( "get_refunds_by_coin_and_contract", "WITH rc AS MATERIALIZED(" "SELECT" - " * FROM refunds ref" - "WHERE ref.coin_pub=$1" - "AND dep.merchant_pub=$2" - "AND dep.h_contract_terms=$3" - ")" + " amount_with_fee_val" + ",amount_with_fee_frac" + ",coin_pub" + ",deposit_serial_id" + " FROM refunds ref" + " WHERE ref.coin_pub=$1)" "SELECT" - " ref.amount_with_fee_val" - " ,ref.amount_with_fee_frac" - "FROM deposits dep" - "JOIN rc" + " rc.amount_with_fee_val" + " ,rc.amount_with_fee_frac" + " FROM " + "(SELECT" + " rc.amount_with_fee_val" + " ,rc.amount_with_fee_frac" + " FROM deposits dep" + " WHERE" + " dep.coin_pub = $1" // optional... + " AND dep.merchant_pub = $2" + " AND dep.h_contract_terms = $3) dep" + " JOIN rc" " USING (coin_pub,deposit_serial_id)"); } qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, -- cgit v1.2.3