summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-10 18:06:18 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-10 18:06:18 +0100
commitaf97a44ae6cdd3c9ee1e15fc88081dcd6890a03d (patch)
tree9eda8d79afbb02a1761d7cb85acf6ee8b7a2c8a9 /src/exchangedb/plugin_exchangedb_postgres.c
parentf70c53d2d60ddc3627d2f58ad0e5a3f69b9f3dd7 (diff)
downloadexchange-af97a44ae6cdd3c9ee1e15fc88081dcd6890a03d.tar.gz
exchange-af97a44ae6cdd3c9ee1e15fc88081dcd6890a03d.tar.bz2
exchange-af97a44ae6cdd3c9ee1e15fc88081dcd6890a03d.zip
complete select_serial_by_* SELECT statements
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c131
1 files changed, 130 insertions, 1 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 679eb0abb..b88524fca 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1752,6 +1752,22 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_denominations",
"SELECT"
" denominations_serial AS serial"
+ ",denom_pub"
+ ",master_sig"
+ ",valid_from"
+ ",expire_withdraw"
+ ",expire_deposit"
+ ",expire_legal"
+ ",coin_val"
+ ",coin_frac"
+ ",fee_withdraw_val"
+ ",fee_withdraw_frac"
+ ",fee_deposit_val"
+ ",fee_deposit_frac"
+ ",fee_refresh_val"
+ ",fee_refresh_frac"
+ ",fee_refund_val"
+ ",fee_refund_frac"
" FROM denominations"
" ORDER BY denominations_serial DESC"
" LIMIT 1;",
@@ -1759,6 +1775,8 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_denomination_revocations",
"SELECT"
" denom_revocations_serial_id AS serial"
+ ",master_sig"
+ ",denominations_serial"
" FROM denomination_revocations"
" ORDER BY denom_revocations_serial_id DESC"
" LIMIT 1;",
@@ -1766,6 +1784,12 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_reserves",
"SELECT"
" reserve_uuid AS serial"
+ ",reserve_pub"
+ ",account_details"
+ ",current_balance_val"
+ ",current_balance_frac"
+ ",expiration_date"
+ ",gc_date"
" FROM reserves"
" ORDER BY reserve_uuid DESC"
" LIMIT 1;",
@@ -1773,6 +1797,13 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_in",
"SELECT"
" reserve_in_serial_id AS serial"
+ ",wire_reference"
+ ",credit_val"
+ ",credit_frac"
+ ",sender_account_details"
+ ",exchange_account_section"
+ ",execution_date"
+ ",reserve_uuid"
" FROM reserves_in"
" ORDER BY reserve_in_serial_id DESC"
" LIMIT 1;",
@@ -1780,6 +1811,14 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_close",
"SELECT"
" close_uuid AS serial"
+ ",execution_date"
+ ",wtid"
+ ",receiver_account"
+ ",amount_val"
+ ",amount_frac"
+ ",closing_fee_val"
+ ",closing_fee_frac"
+ ",reserve_uuid"
" FROM reserves_close"
" ORDER BY close_uuid DESC"
" LIMIT 1;",
@@ -1787,6 +1826,14 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_reserves_out",
"SELECT"
" reserve_out_serial_id AS serial"
+ ",h_blind_ev"
+ ",denom_sig"
+ ",reserve_sig"
+ ",execution_date"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",reserve_uuid"
+ ",denominations_serial"
" FROM reserves_out"
" ORDER BY reserve_out_serial_id DESC"
" LIMIT 1;",
@@ -1794,6 +1841,11 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_auditors",
"SELECT"
" auditor_uuid AS serial"
+ ",auditor_pub"
+ ",auditor_name"
+ ",auditor_url"
+ ",is_active"
+ ",last_change"
" FROM auditors"
" ORDER BY auditor_uuid DESC"
" LIMIT 1;",
@@ -1801,6 +1853,9 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_auditor_denom_sigs",
"SELECT"
" auditor_denom_serial AS serial"
+ ",auditor_uuid"
+ ",denominations_serial"
+ ",auditor_sig"
" FROM auditor_denom_sigs"
" ORDER BY auditor_denom_serial DESC"
" LIMIT 1;",
@@ -1808,6 +1863,11 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_exchange_sign_keys",
"SELECT"
" esk_serial AS serial"
+ ",exchange_pub"
+ ",master_sig"
+ ",valid_from"
+ ",expire_sign"
+ ",expire_legal"
" FROM exchange_sign_keys"
" ORDER BY esk_serial DESC"
" LIMIT 1;",
@@ -1815,6 +1875,8 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_signkey_revocations",
"SELECT"
" signkey_revocations_serial_id AS serial"
+ ",esk_serial"
+ ",master_sig"
" FROM signkey_revocations"
" ORDER BY signkey_revocations_serial_id DESC"
" LIMIT 1;",
@@ -1822,6 +1884,9 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_known_coins",
"SELECT"
" known_coin_id AS serial"
+ ",coin_pub"
+ ",denom_sig"
+ ",denominations_serial"
" FROM known_coins"
" ORDER BY known_coin_id DESC"
" LIMIT 1;",
@@ -1829,6 +1894,12 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_commitments",
"SELECT"
" melt_serial_id AS serial"
+ ",rc"
+ ",old_coin_sig"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",noreveal_index"
+ ",old_known_coin_id"
" FROM refresh_commitments"
" ORDER BY melt_serial_id DESC"
" LIMIT 1;",
@@ -1836,6 +1907,12 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_revealed_coins",
"SELECT"
" rrc_serial AS serial"
+ ",freshcoin_index"
+ ",link_sig"
+ ",coin_ev"
+ ",ev_sig"
+ ",denominations_serial"
+ ",melt_serial_id"
" FROM refresh_revealed_coins"
" ORDER BY rrc_serial DESC"
" LIMIT 1;",
@@ -1843,6 +1920,9 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_refresh_transfer_keys",
"SELECT"
" rtc_serial AS serial"
+ ",transfer_pub"
+ ",transfer_privs"
+ ",melt_serial_id"
" FROM refresh_transfer_keys"
" ORDER BY rtc_serial DESC"
" LIMIT 1;",
@@ -1850,6 +1930,19 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_deposits",
"SELECT"
" deposit_serial_id AS serial"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",wallet_timestamp"
+ ",exchange_timestamp"
+ ",refund_deadline"
+ ",wire_deadline"
+ ",merchant_pub"
+ ",h_contract_terms"
+ ",coin_sig"
+ ",wire"
+ ",tiny"
+ ",done"
+ ",known_coin_id"
" FROM deposits"
" ORDER BY deposit_serial_id DESC"
" LIMIT 1;",
@@ -1857,6 +1950,11 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_refunds",
"SELECT"
" refund_serial_id AS serial"
+ ",merchant_sig"
+ ",rtransaction_id"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",deposit_serial_id"
" FROM refunds"
" ORDER BY refund_serial_id DESC"
" LIMIT 1;",
@@ -1864,6 +1962,12 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_wire_out",
"SELECT"
" wireout_uuid AS serial"
+ ",execution_date"
+ ",wtid_raw"
+ ",wire_target"
+ ",exchange_account_section"
+ ",amount_val"
+ ",amount_frac"
" FROM wire_out"
" ORDER BY wireout_uuid DESC"
" LIMIT 1;",
@@ -1871,6 +1975,8 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_aggregation_tracking",
"SELECT"
" aggregation_serial_id AS serial"
+ ",deposit_serial_id"
+ ",wtid_raw"
" FROM aggregation_tracking"
" ORDER BY aggregation_serial_id DESC"
" LIMIT 1;",
@@ -1878,6 +1984,14 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_wire_fee",
"SELECT"
" wire_fee_serial AS serial"
+ ",wire_method"
+ ",start_date"
+ ",end_date"
+ ",wire_fee_val"
+ ",wire_fee_frac"
+ ",closing_fee_val"
+ ",closing_fee_frac"
+ ",master_sig"
" FROM wire_fee"
" ORDER BY wire_fee_serial DESC"
" LIMIT 1;",
@@ -1885,6 +1999,13 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_recoup",
"SELECT"
" recoup_uuid AS serial"
+ ",coin_sig"
+ ",coin_blind"
+ ",amount_val"
+ ",amount_frac"
+ ",timestamp"
+ ",known_coin_id"
+ ",reserve_out_serial_id"
" FROM recoup"
" ORDER BY recoup_uuid DESC"
" LIMIT 1;",
@@ -1892,6 +2013,13 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("select_serial_by_table_recoup_refresh",
"SELECT"
" recoup_refresh_uuid AS serial"
+ ",coin_sig"
+ ",coin_blind"
+ ",amount_val"
+ ",amount_frac"
+ ",timestamp"
+ ",known_coin_id"
+ ",rrc_serial"
" FROM recoup_refresh"
" ORDER BY recoup_refresh_uuid DESC"
" LIMIT 1;",
@@ -3414,7 +3542,8 @@ postgres_reserves_in_insert (void *cls,
before adding the actual transaction to "reserves_in", as
for a new reserve it can't be a duplicate 'add' operation,
and as the 'add' operation may need the reserve entry
- as a foreign key. */struct GNUNET_PQ_QueryParam params[] = {
+ as a foreign key. */
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_string (sender_account_details),
TALER_PQ_query_param_amount (balance),