From b8dada34033a64c02ef3b463d7ef67515cbc27d4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 8 Oct 2022 12:47:14 +0200 Subject: -more db logic refactoring --- src/exchangedb/plugin_exchangedb_postgres.c | 480 ---------------------------- 1 file changed, 480 deletions(-) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 04455808c..a98551d07 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -3612,486 +3612,6 @@ prepare_statements (struct PostgresClosure *pg) " WHERE profit_drain_serial_id > $1" " ORDER BY profit_drain_serial_id ASC;", 1), - /* For postgres_insert_records_by_table */ - GNUNET_PQ_make_prepare ( - "insert_into_table_denominations", - "INSERT INTO denominations" - "(denominations_serial" - ",denom_pub_hash" - ",denom_type" - ",age_mask" - ",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" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11, $12, $13, $14, $15, $16, $17, $18, $19, $20);", - 20), - GNUNET_PQ_make_prepare ( - "insert_into_table_denomination_revocations", - "INSERT INTO denomination_revocations" - "(denom_revocations_serial_id" - ",master_sig" - ",denominations_serial" - ") VALUES " - "($1, $2, $3);", - 3), - GNUNET_PQ_make_prepare ( - "insert_into_table_wire_targets", - "INSERT INTO wire_targets" - "(wire_target_serial_id" - ",wire_target_h_payto" - ",payto_uri" - ") VALUES " - "($1, $2, $3);", - 3), - GNUNET_PQ_make_prepare ( - "insert_into_table_reserves", - "INSERT INTO reserves" - "(reserve_uuid" - ",reserve_pub" - ",expiration_date" - ",gc_date" - ") VALUES " - "($1, $2, $3, $4);", - 4), - GNUNET_PQ_make_prepare ( - "insert_into_table_reserves_in", - "INSERT INTO reserves_in" - "(reserve_in_serial_id" - ",wire_reference" - ",credit_val" - ",credit_frac" - ",wire_source_h_payto" - ",exchange_account_section" - ",execution_date" - ",reserve_pub" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8);", - 8), - GNUNET_PQ_make_prepare ( - "insert_into_table_reserves_close", - "INSERT INTO reserves_close" - "(close_uuid" - ",execution_date" - ",wtid" - ",wire_target_h_payto" - ",amount_val" - ",amount_frac" - ",closing_fee_val" - ",closing_fee_frac" - ",reserve_pub" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9);", - 9), - GNUNET_PQ_make_prepare ( - "insert_into_table_reserves_out", - "INSERT INTO reserves_out" - "(reserve_out_serial_id" - ",h_blind_ev" - ",denominations_serial" - ",denom_sig" - ",reserve_uuid" - ",reserve_sig" - ",execution_date" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9);", - 9), - GNUNET_PQ_make_prepare ( - "insert_into_table_auditors", - "INSERT INTO auditors" - "(auditor_uuid" - ",auditor_pub" - ",auditor_name" - ",auditor_url" - ",is_active" - ",last_change" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_auditor_denom_sigs", - "INSERT INTO auditor_denom_sigs" - "(auditor_denom_serial" - ",auditor_uuid" - ",denominations_serial" - ",auditor_sig" - ") VALUES " - "($1, $2, $3, $4);", - 4), - GNUNET_PQ_make_prepare ( - "insert_into_table_exchange_sign_keys", - "INSERT INTO exchange_sign_keys" - "(esk_serial" - ",exchange_pub" - ",master_sig" - ",valid_from" - ",expire_sign" - ",expire_legal" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_signkey_revocations", - "INSERT INTO signkey_revocations" - "(signkey_revocations_serial_id" - ",esk_serial" - ",master_sig" - ") VALUES " - "($1, $2, $3);", - 3), - GNUNET_PQ_make_prepare ( - "insert_into_table_known_coins", - "INSERT INTO known_coins" - "(known_coin_id" - ",coin_pub" - ",denom_sig" - ",denominations_serial" - ") VALUES " - "($1, $2, $3, $4);", - 4), - GNUNET_PQ_make_prepare ( - "insert_into_table_refresh_commitments", - "INSERT INTO refresh_commitments" - "(melt_serial_id" - ",rc" - ",old_coin_sig" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",noreveal_index" - ",old_coin_pub" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7);", - 7), - GNUNET_PQ_make_prepare ( - "insert_into_table_refresh_revealed_coins", - "INSERT INTO refresh_revealed_coins" - "(rrc_serial" - ",freshcoin_index" - ",link_sig" - ",coin_ev" - ",h_coin_ev" - ",ev_sig" - ",ewv" - ",denominations_serial" - ",melt_serial_id" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9);", - 9), - GNUNET_PQ_make_prepare ( - "insert_into_table_refresh_transfer_keys", - "INSERT INTO refresh_transfer_keys" - "(rtc_serial" - ",transfer_pub" - ",transfer_privs" - ",melt_serial_id" - ") VALUES " - "($1, $2, $3, $4);", - 4), - GNUNET_PQ_make_prepare ( - "insert_into_table_deposits", - "INSERT INTO deposits" - "(deposit_serial_id" - ",shard" - ",known_coin_id" - ",coin_pub" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",wallet_timestamp" - ",exchange_timestamp" - ",refund_deadline" - ",wire_deadline" - ",merchant_pub" - ",h_contract_terms" - ",coin_sig" - ",wire_salt" - ",wire_target_h_payto" - ",extension_blocked" - ",extension_details_serial_id" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," - " $11, $12, $13, $14, $15, $16, $17);", - 17), - GNUNET_PQ_make_prepare ( - "insert_into_table_refunds", - "INSERT INTO refunds" - "(refund_serial_id" - ",coin_pub" - ",merchant_sig" - ",rtransaction_id" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",deposit_serial_id" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7);", - 7), - GNUNET_PQ_make_prepare ( - "insert_into_table_aggregation_tracking", - "INSERT INTO aggregation_tracking" - "(aggregation_serial_id" - ",deposit_serial_id" - ",wtid_raw" - ") VALUES " - "($1, $2, $3);", - 3), - GNUNET_PQ_make_prepare ( - "insert_into_table_wire_fee", - "INSERT INTO wire_fee" - "(wire_fee_serial" - ",wire_method" - ",start_date" - ",end_date" - ",wire_fee_val" - ",wire_fee_frac" - ",closing_fee_val" - ",closing_fee_frac" - ",wad_fee_val" - ",wad_fee_frac" - ",master_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);", - 11), - GNUNET_PQ_make_prepare ( - "insert_into_table_global_fee", - "INSERT INTO global_fee" - "(global_fee_serial" - ",start_date" - ",end_date" - ",history_fee_val" - ",history_fee_frac" - ",kyc_fee_val" - ",kyc_fee_frac" - ",account_fee_val" - ",account_fee_frac" - ",purse_fee_val" - ",purse_fee_frac" - ",purse_timeout" - ",kyc_timeout" - ",history_expiration" - ",purse_account_limit" - ",master_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);", - 16), - GNUNET_PQ_make_prepare ( - "insert_into_table_recoup", - "INSERT INTO recoup" - "(recoup_uuid" - ",coin_sig" - ",coin_blind" - ",amount_val" - ",amount_frac" - ",recoup_timestamp" - ",coin_pub" - ",reserve_out_serial_id" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8);", - 8), - GNUNET_PQ_make_prepare ( - "insert_into_table_recoup_refresh", - "INSERT INTO recoup_refresh" - "(recoup_refresh_uuid" - ",coin_sig" - ",coin_blind" - ",amount_val" - ",amount_frac" - ",recoup_timestamp" - ",known_coin_id" - ",coin_pub" - ",rrc_serial" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9);", - 9), - GNUNET_PQ_make_prepare ( - "insert_into_table_extensions", - "INSERT INTO extensions" - "(extension_id" - ",name" - ",config" - ") VALUES " - "($1, $2, $3);", - 3), - GNUNET_PQ_make_prepare ( - "insert_into_table_extension_details", - "INSERT INTO extension_details" - "(extension_details_serial_id" - ",extension_options" - ") VALUES " - "($1, $2);", - 2), - - GNUNET_PQ_make_prepare ( - "insert_into_table_purse_requests", - "INSERT INTO purse_requests" - "(purse_requests_serial_id" - ",purse_pub" - ",merge_pub" - ",purse_creation" - ",purse_expiration" - ",h_contract_terms" - ",age_limit" - ",flags" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",purse_fee_val" - ",purse_fee_frac" - ",purse_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13);", - 13), - GNUNET_PQ_make_prepare ( - "insert_into_table_purse_refunds", - "INSERT INTO purse_refunds" - "(purse_refunds_serial_id" - ",purse_pub" - ") VALUES " - "($1, $2);", - 2), - GNUNET_PQ_make_prepare ( - "insert_into_table_purse_merges", - "INSERT INTO purse_merges" - "(purse_merge_request_serial_id" - ",partner_serial_id" - ",reserve_pub" - ",purse_pub" - ",merge_sig" - ",merge_timestamp" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_purse_deposits", - "INSERT INTO purse_deposits" - "(purse_deposit_serial_id" - ",partner_serial_id" - ",purse_pub" - ",coin_pub" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",coin_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7);", - 7), - GNUNET_PQ_make_prepare ( - "insert_into_table_history_requests", - "INSERT INTO history_requests" - "(history_request_serial_id" - ",reserve_pub" - ",request_timestamp" - ",reserve_sig" - ",history_fee_val" - ",history_fee_frac" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_close_requests", - "INSERT INTO close_requests" - "(close_request_serial_id" - ",reserve_pub" - ",close_timestamp" - ",reserve_sig" - ",close_val" - ",close_frac" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_wads_out", - "INSERT INTO wads_out" - "(wad_out_serial_id" - ",wad_id" - ",partner_serial_id" - ",amount_val" - ",amount_frac" - ",execution_time" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_wad_out_entries", - "INSERT INTO wad_out_entries" - "(wad_out_entry_serial_id" - ",wad_out_serial_id" - ",reserve_pub" - ",purse_pub" - ",h_contract" - ",purse_expiration" - ",merge_timestamp" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",wad_fee_val" - ",wad_fee_frac" - ",deposit_fees_val" - ",deposit_fees_frac" - ",reserve_sig" - ",purse_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15);", - 15), - GNUNET_PQ_make_prepare ( - "insert_into_table_wads_in", - "INSERT INTO wads_in" - "(wad_in_serial_id" - ",wad_id" - ",origin_exchange_url" - ",amount_val" - ",amount_frac" - ",arrival_time" - ") VALUES " - "($1, $2, $3, $4, $5, $6);", - 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_wad_in_entries", - "INSERT INTO wad_in_entries" - "(wad_in_entry_serial_id" - ",wad_in_serial_id" - ",reserve_pub" - ",purse_pub" - ",h_contract" - ",purse_expiration" - ",merge_timestamp" - ",amount_with_fee_val" - ",amount_with_fee_frac" - ",wad_fee_val" - ",wad_fee_frac" - ",deposit_fees_val" - ",deposit_fees_frac" - ",reserve_sig" - ",purse_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15);", - 15), - GNUNET_PQ_make_prepare ( - "insert_into_table_profit_drains", - "INSERT INTO profit_drains" - "(profit_drain_serial_id" - ",wtid" - ",account_section" - ",payto_uri" - ",trigger_date" - ",amount_val" - ",amount_frac" - ",master_sig" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8);", - 8), - /* Used in #postgres_begin_shard() */ GNUNET_PQ_make_prepare ( "get_open_shard", -- cgit v1.2.3