diff --git a/src/exchangedb/pg_insert_records_by_table.c b/src/exchangedb/pg_insert_records_by_table.c index 2d41390ea..b82b78e0a 100644 --- a/src/exchangedb/pg_insert_records_by_table.c +++ b/src/exchangedb/pg_insert_records_by_table.c @@ -217,6 +217,17 @@ irbt_cb_table_legitimization_processes (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_legitimization_processes", + "INSERT INTO legitimization_processes" + "(legitimization_process_serial_id" + ",h_payto" + ",expiration_time" + ",provider_section" + ",provider_user_id" + ",provider_legitimization_id" + ") VALUES " + "($1, $2, $3, $4, $5, $6);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_legitimization_processes", params); @@ -243,6 +254,14 @@ irbt_cb_table_legitimization_requirements (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_legitimization_requirements", + "INSERT INTO legitimization_requirements" + "(legitimization_requirement_serial_id" + ",h_payto" + ",required_checks" + ") VALUES " + "($1, $2, $3);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_legitimization_requirements", params); @@ -351,6 +370,19 @@ irbt_cb_table_reserves_open_requests (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_reserves_open_requests", + "INSERT INTO reserves_open_requests" + "(open_request_uuid" + ",reserve_pub" + ",request_timestamp" + ",expiration_date" + ",reserve_sig" + ",reserve_payment_val" + ",reserve_payment_frac" + ",requested_purse_limit" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_reserves_open_requests", params); @@ -364,9 +396,9 @@ irbt_cb_table_reserves_open_requests (struct PostgresClosure *pg, * @param td record to insert */ static enum GNUNET_DB_QueryStatus -irbt_cb_table_reserves_open_deposits (struct PostgresClosure *pg, - const struct - TALER_EXCHANGEDB_TableData *td) +irbt_cb_table_reserves_open_deposits ( + struct PostgresClosure *pg, + const struct TALER_EXCHANGEDB_TableData *td) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), @@ -383,6 +415,19 @@ irbt_cb_table_reserves_open_deposits (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_reserves_open_deposits", + "INSERT INTO reserves_open_deposits" + "(reserve_open_deposit_uuid" + ",reserve_sig" + ",reserve_pub" + ",request_timestamp" + ",coin_pub" + ",coin_sig" + ",contribution_val" + ",contribution_frac" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7, $8);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_reserves_open_deposits", params); @@ -396,9 +441,9 @@ irbt_cb_table_reserves_open_deposits (struct PostgresClosure *pg, * @param td record to insert */ static enum GNUNET_DB_QueryStatus -irbt_cb_table_reserves_close_requests (struct PostgresClosure *pg, - const struct - TALER_EXCHANGEDB_TableData *td) +irbt_cb_table_reserves_close_requests ( + struct PostgresClosure *pg, + const struct TALER_EXCHANGEDB_TableData *td) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), @@ -413,6 +458,16 @@ irbt_cb_table_reserves_close_requests (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_reserves_close_requests", + "INSERT INTO reserves_close_requests" + "(close_request_uuid" + ",reserve_pub" + ",execution_date" + ",reserve_sig" + ",wire_target_h_payto" + ") VALUES " + "($1, $2, $3, $4, $5);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_reserves_close_requests", params); @@ -959,7 +1014,18 @@ irbt_cb_table_wire_out (struct PostgresClosure *pg, GNUNET_PQ_query_param_end }; - + PREPARE (pg, + "insert_into_table_wire_out", + "INSERT INTO wire_out" + "(wireout_uuid" + ",execution_date" + ",wtid_raw" + ",wire_target_h_payto" + ",exchange_account_section" + ",amount_val" + ",amount_frac" + ") VALUES " + "($1, $2, $3, $4, $5, $6, $7);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_into_table_wire_out", params); @@ -1440,11 +1506,23 @@ irbt_cb_table_account_mergers (struct PostgresClosure *pg, &td->details.account_merges.reserve_sig), GNUNET_PQ_query_param_auto_from_type ( &td->details.account_merges.purse_pub), + GNUNET_PQ_query_param_auto_from_type ( + &td->details.account_merges.wallet_h_payto), GNUNET_PQ_query_param_end }; + PREPARE (pg, + "insert_into_table_account_merges", + "INSERT INTO account_merges" + "(account_merge_request_serial_id" + ",reserve_pub" + ",reserve_sig" + ",purse_pub" + ",wallet_h_payto" + ") VALUES " + "($1, $2, $3, $4, $5);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_into_table_account_mergers", + "insert_into_table_account_merges", params); } @@ -1789,6 +1867,12 @@ TEH_PG_insert_records_by_table (void *cls, case TALER_EXCHANGEDB_RT_WIRE_TARGETS: rh = &irbt_cb_table_wire_targets; break; + case TALER_EXCHANGEDB_RT_LEGITIMIZATION_PROCESSES: + rh = &irbt_cb_table_legitimization_processes; + break; + case TALER_EXCHANGEDB_RT_LEGITIMIZATION_REQUIREMENTS: + rh = &irbt_cb_table_legitimization_requirements; + break; case TALER_EXCHANGEDB_RT_RESERVES: rh = &irbt_cb_table_reserves; break; @@ -1798,6 +1882,15 @@ TEH_PG_insert_records_by_table (void *cls, case TALER_EXCHANGEDB_RT_RESERVES_CLOSE: rh = &irbt_cb_table_reserves_close; break; + case TALER_EXCHANGEDB_RT_RESERVES_OPEN_REQUESTS: + rh = &irbt_cb_table_reserves_open_requests; + break; + case TALER_EXCHANGEDB_RT_RESERVES_OPEN_DEPOSITS: + rh = &irbt_cb_table_reserves_open_deposits; + break; + case TALER_EXCHANGEDB_RT_RESERVES_CLOSE_REQUESTS: + rh = &irbt_cb_table_reserves_close_requests; + break; case TALER_EXCHANGEDB_RT_RESERVES_OUT: rh = &irbt_cb_table_reserves_out; break; diff --git a/src/exchangedb/pg_lookup_records_by_table.c b/src/exchangedb/pg_lookup_records_by_table.c index 8368d926b..9e47de481 100644 --- a/src/exchangedb/pg_lookup_records_by_table.c +++ b/src/exchangedb/pg_lookup_records_by_table.c @@ -1766,6 +1766,9 @@ lrbt_cb_table_account_merges (void *cls, GNUNET_PQ_result_spec_auto_from_type ( "purse_pub", &td.details.account_merges.purse_pub), + GNUNET_PQ_result_spec_auto_from_type ( + "wallet_h_payto", + &td.details.account_merges.wallet_h_payto), GNUNET_PQ_result_spec_end }; @@ -2673,6 +2676,7 @@ TEH_PG_lookup_records_by_table (void *cls, ",reserve_pub" ",reserve_sig" ",purse_pub" + ",wallet_h_payto" " FROM account_merges" " WHERE account_merge_request_serial_id > $1" " ORDER BY account_merge_request_serial_id ASC;"); @@ -2822,4 +2826,4 @@ TEH_PG_lookup_records_by_table (void *cls, #undef XPREPARE -/* end of lrbt_callbacks.c */ +/* end of pg_lookup_records_by_table.c */ diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index f7779e914..1bb835877 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2036,19 +2036,6 @@ prepare_statements (struct PostgresClosure *pg) ") VALUES " "($1, $2, $3, $4, $5, $6);", 6), - GNUNET_PQ_make_prepare ( - "insert_into_table_wire_out", - "INSERT INTO wire_out" - "(wireout_uuid" - ",execution_date" - ",wtid_raw" - ",wire_target_h_payto" - ",exchange_account_section" - ",amount_val" - ",amount_frac" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7);", - 7), /* Used in #postgres_wire_prepare_data_insert() to store wire transfer information before actually committing it with the bank */ GNUNET_PQ_make_prepare ( diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index a6b7a616e..008909c31 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -571,6 +571,7 @@ struct TALER_EXCHANGEDB_TableData struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReserveSignatureP reserve_sig; struct TALER_PurseContractPublicKeyP purse_pub; + struct TALER_PaytoHashP wallet_h_payto; } account_merges; struct