aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_get_reserve_history.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-29 23:01:06 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-29 23:01:15 +0200
commite47e5c0cfba7746263775e8bbd4064b640f69020 (patch)
tree4d853f7e1d065a198b32dd14d38df179cf288e15 /src/exchangedb/pg_get_reserve_history.c
parentecf6b2750bb6ed9157aece72602dd042a50e36f3 (diff)
downloadexchange-e47e5c0cfba7746263775e8bbd4064b640f69020.tar.xz
migration to new amount style for exchangedb
Diffstat (limited to 'src/exchangedb/pg_get_reserve_history.c')
-rw-r--r--src/exchangedb/pg_get_reserve_history.c162
1 files changed, 66 insertions, 96 deletions
diff --git a/src/exchangedb/pg_get_reserve_history.c b/src/exchangedb/pg_get_reserve_history.c
index 6c12abc61..86a33946d 100644
--- a/src/exchangedb/pg_get_reserve_history.c
+++ b/src/exchangedb/pg_get_reserve_history.c
@@ -653,8 +653,7 @@ TEH_PG_get_reserve_history (void *cls,
/*
"SELECT"
" wire_reference"
- ",credit_val"
- ",credit_frac"
+ ",credit"
",execution_date"
",payto_uri AS sender_account_details"
" FROM reserves_in"
@@ -667,14 +666,13 @@ TEH_PG_get_reserve_history (void *cls,
" FROM reserves_in "
" WHERE reserve_pub = $1 "
") "
- "SELECT "
- " wire_reference "
- " ,credit_val "
- " ,credit_frac "
- " ,execution_date "
- " ,payto_uri AS sender_account_details "
- "FROM wire_targets "
- "JOIN ri "
+ "SELECT"
+ " wire_reference"
+ " ,credit"
+ " ,execution_date"
+ " ,payto_uri AS sender_account_details"
+ " FROM wire_targets"
+ " JOIN ri"
" ON (wire_target_h_payto = wire_source_h_payto) "
"WHERE wire_target_h_payto = ( "
" SELECT wire_source_h_payto FROM ri "
@@ -688,10 +686,8 @@ TEH_PG_get_reserve_history (void *cls,
",ro.denom_sig"
",ro.reserve_sig"
",ro.execution_date"
- ",ro.amount_with_fee_val"
- ",ro.amount_with_fee_frac"
- ",denom.fee_withdraw_val"
- ",denom.fee_withdraw_frac"
+ ",ro.amount_with_fee"
+ ",denom.fee_withdraw"
" FROM reserves res"
" JOIN reserves_out_by_reserve ror"
" ON (res.reserve_uuid = ror.reserve_uuid)"
@@ -709,21 +705,19 @@ TEH_PG_get_reserve_history (void *cls,
" FROM reserves "
" WHERE reserve_pub = $1 "
" ) "
- ") SELECT "
- " ro.h_blind_ev "
- " ,denom.denom_pub_hash "
- " ,ro.denom_sig "
- " ,ro.reserve_sig "
- " ,ro.execution_date "
- " ,ro.amount_with_fee_val "
- " ,ro.amount_with_fee_frac "
- " ,denom.fee_withdraw_val "
- " ,denom.fee_withdraw_frac "
- "FROM robr "
- "JOIN reserves_out ro "
- " ON (ro.h_blind_ev = robr.h_blind_ev) "
- "JOIN denominations denom "
- " ON (ro.denominations_serial = denom.denominations_serial);");
+ ") SELECT"
+ " ro.h_blind_ev"
+ " ,denom.denom_pub_hash"
+ " ,ro.denom_sig"
+ " ,ro.reserve_sig"
+ " ,ro.execution_date"
+ " ,ro.amount_with_fee"
+ " ,denom.fee_withdraw"
+ " FROM robr"
+ " JOIN reserves_out ro"
+ " ON (ro.h_blind_ev = robr.h_blind_ev)"
+ " JOIN denominations denom"
+ " ON (ro.denominations_serial = denom.denominations_serial);");
PREPARE (pg,
"recoup_by_reserve",
/*
@@ -731,8 +725,7 @@ TEH_PG_get_reserve_history (void *cls,
" recoup.coin_pub"
",recoup.coin_sig"
",recoup.coin_blind"
- ",recoup.amount_val"
- ",recoup.amount_frac"
+ ",recoup.amount"
",recoup.recoup_timestamp"
",denominations.denom_pub_hash"
",known_coins.denom_sig"
@@ -753,10 +746,9 @@ TEH_PG_get_reserve_history (void *cls,
" WHERE reserves.reserve_pub=$1);",
*/
"SELECT robr.coin_pub "
- " ,robr.coin_sig "
- " ,robr.coin_blind "
- " ,robr.amount_val "
- " ,robr.amount_frac "
+ " ,robr.coin_sig"
+ " ,robr.coin_blind"
+ " ,robr.amount"
" ,robr.recoup_timestamp "
" ,denominations.denom_pub_hash "
" ,robr.denom_sig "
@@ -766,10 +758,8 @@ TEH_PG_get_reserve_history (void *cls,
PREPARE (pg,
"close_by_reserve",
"SELECT"
- " amount_val"
- ",amount_frac"
- ",closing_fee_val"
- ",closing_fee_frac"
+ " amount"
+ ",closing_fee"
",execution_date"
",payto_uri AS receiver_account"
",wtid"
@@ -780,12 +770,9 @@ TEH_PG_get_reserve_history (void *cls,
PREPARE (pg,
"merge_by_reserve",
"SELECT"
- " pr.amount_with_fee_val"
- ",pr.amount_with_fee_frac"
- ",pr.balance_val"
- ",pr.balance_frac"
- ",pr.purse_fee_val"
- ",pr.purse_fee_frac"
+ " pr.amount_with_fee"
+ ",pr.balance"
+ ",pr.purse_fee"
",pr.h_contract_terms"
",pr.merge_pub"
",am.reserve_sig"
@@ -808,8 +795,7 @@ TEH_PG_get_reserve_history (void *cls,
PREPARE (pg,
"history_by_reserve",
"SELECT"
- " history_fee_val"
- ",history_fee_frac"
+ " history_fee"
",request_timestamp"
",reserve_sig"
" FROM history_requests"
@@ -817,8 +803,7 @@ TEH_PG_get_reserve_history (void *cls,
PREPARE (pg,
"open_request_by_reserve",
"SELECT"
- " reserve_payment_val"
- ",reserve_payment_frac"
+ " reserve_payment"
",request_timestamp"
",expiration_date"
",requested_purse_limit"
@@ -944,8 +929,7 @@ TEH_PG_get_reserve_status (void *cls,
/*
"SELECT"
" wire_reference"
- ",credit_val"
- ",credit_frac"
+ ",credit"
",execution_date"
",payto_uri AS sender_account_details"
" FROM reserves_in"
@@ -960,15 +944,14 @@ TEH_PG_get_reserve_status (void *cls,
" WHERE reserve_pub = $1 "
") "
"SELECT "
- " wire_reference "
- " ,credit_val "
- " ,credit_frac "
- " ,execution_date "
- " ,payto_uri AS sender_account_details "
- "FROM wire_targets "
- "JOIN ri "
- " ON (wire_target_h_payto = wire_source_h_payto) "
- "WHERE execution_date >= $2"
+ " wire_reference"
+ " ,credit"
+ " ,execution_date"
+ " ,payto_uri AS sender_account_details"
+ " FROM wire_targets"
+ " JOIN ri"
+ " ON (wire_target_h_payto = wire_source_h_payto)"
+ " WHERE execution_date >= $2"
" AND wire_target_h_payto = ( "
" SELECT wire_source_h_payto FROM ri "
"); ");
@@ -981,10 +964,8 @@ TEH_PG_get_reserve_status (void *cls,
",ro.denom_sig"
",ro.reserve_sig"
",ro.execution_date"
- ",ro.amount_with_fee_val"
- ",ro.amount_with_fee_frac"
- ",denom.fee_withdraw_val"
- ",denom.fee_withdraw_frac"
+ ",ro.amount_with_fee"
+ ",denom.fee_withdraw"
" FROM reserves res"
" JOIN reserves_out_by_reserve ror"
" ON (res.reserve_uuid = ror.reserve_uuid)"
@@ -1004,20 +985,18 @@ TEH_PG_get_reserve_status (void *cls,
" WHERE reserve_pub = $1 "
" ) "
") SELECT "
- " ro.h_blind_ev "
- " ,denom.denom_pub_hash "
- " ,ro.denom_sig "
- " ,ro.reserve_sig "
- " ,ro.execution_date "
- " ,ro.amount_with_fee_val "
- " ,ro.amount_with_fee_frac "
- " ,denom.fee_withdraw_val "
- " ,denom.fee_withdraw_frac "
- "FROM robr "
- "JOIN reserves_out ro "
- " ON (ro.h_blind_ev = robr.h_blind_ev) "
- "JOIN denominations denom "
- " ON (ro.denominations_serial = denom.denominations_serial)"
+ " ro.h_blind_ev"
+ " ,denom.denom_pub_hash"
+ " ,ro.denom_sig"
+ " ,ro.reserve_sig"
+ " ,ro.execution_date"
+ " ,ro.amount_with_fee"
+ " ,denom.fee_withdraw"
+ " FROM robr"
+ " JOIN reserves_out ro"
+ " ON (ro.h_blind_ev = robr.h_blind_ev)"
+ " JOIN denominations denom"
+ " ON (ro.denominations_serial = denom.denominations_serial)"
" WHERE ro.execution_date>=$2;");
PREPARE (pg,
"recoup_by_reserve_truncated",
@@ -1026,8 +1005,7 @@ TEH_PG_get_reserve_status (void *cls,
" recoup.coin_pub"
",recoup.coin_sig"
",recoup.coin_blind"
- ",recoup.amount_val"
- ",recoup.amount_frac"
+ ",recoup.amount"
",recoup.recoup_timestamp"
",denominations.denom_pub_hash"
",known_coins.denom_sig"
@@ -1051,8 +1029,7 @@ TEH_PG_get_reserve_status (void *cls,
"SELECT robr.coin_pub "
" ,robr.coin_sig "
" ,robr.coin_blind "
- " ,robr.amount_val "
- " ,robr.amount_frac "
+ " ,robr.amount"
" ,robr.recoup_timestamp "
" ,denominations.denom_pub_hash "
" ,robr.denom_sig "
@@ -1063,10 +1040,8 @@ TEH_PG_get_reserve_status (void *cls,
PREPARE (pg,
"close_by_reserve_truncated",
"SELECT"
- " amount_val"
- ",amount_frac"
- ",closing_fee_val"
- ",closing_fee_frac"
+ " amount"
+ ",closing_fee"
",execution_date"
",payto_uri AS receiver_account"
",wtid"
@@ -1078,12 +1053,9 @@ TEH_PG_get_reserve_status (void *cls,
PREPARE (pg,
"merge_by_reserve_truncated",
"SELECT"
- " pr.amount_with_fee_val"
- ",pr.amount_with_fee_frac"
- ",pr.balance_val"
- ",pr.balance_frac"
- ",pr.purse_fee_val"
- ",pr.purse_fee_frac"
+ " pr.amount_with_fee"
+ ",pr.balance"
+ ",pr.purse_fee"
",pr.h_contract_terms"
",pr.merge_pub"
",am.reserve_sig"
@@ -1107,8 +1079,7 @@ TEH_PG_get_reserve_status (void *cls,
PREPARE (pg,
"history_by_reserve_truncated",
"SELECT"
- " history_fee_val"
- ",history_fee_frac"
+ " history_fee"
",request_timestamp"
",reserve_sig"
" FROM history_requests"
@@ -1117,8 +1088,7 @@ TEH_PG_get_reserve_status (void *cls,
PREPARE (pg,
"open_request_by_reserve_truncated",
"SELECT"
- " reserve_payment_val"
- ",reserve_payment_frac"
+ " reserve_payment"
",request_timestamp"
",expiration_date"
",requested_purse_limit"