diff options
Diffstat (limited to 'src/exchangedb/pg_insert_records_by_table.c')
-rw-r--r-- | src/exchangedb/pg_insert_records_by_table.c | 90 |
1 files changed, 16 insertions, 74 deletions
diff --git a/src/exchangedb/pg_insert_records_by_table.c b/src/exchangedb/pg_insert_records_by_table.c index 9baaf3b1a..a8b71759c 100644 --- a/src/exchangedb/pg_insert_records_by_table.c +++ b/src/exchangedb/pg_insert_records_by_table.c @@ -2057,38 +2057,37 @@ irbt_cb_table_purse_deletion (struct PostgresClosure *pg, /** - * Function called with age_withdraw_commitments records to insert into table. + * Function called with age_withdraw records to insert into table. * * @param pg plugin context * @param td record to insert */ static enum GNUNET_DB_QueryStatus -irbt_cb_table_age_withdraw_commitments (struct PostgresClosure *pg, - const struct - TALER_EXCHANGEDB_TableData *td) +irbt_cb_table_age_withdraw (struct PostgresClosure *pg, + const struct + TALER_EXCHANGEDB_TableData *td) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_auto_from_type ( - &td->details.age_withdraw_commitments.h_commitment), + &td->details.age_withdraw.h_commitment), TALER_PQ_query_param_amount ( - &td->details.age_withdraw_commitments.amount_with_fee), + &td->details.age_withdraw.amount_with_fee), GNUNET_PQ_query_param_uint16 ( - &td->details.age_withdraw_commitments.max_age), + &td->details.age_withdraw.max_age), GNUNET_PQ_query_param_auto_from_type ( - &td->details.age_withdraw_commitments.reserve_pub), + &td->details.age_withdraw.reserve_pub), GNUNET_PQ_query_param_auto_from_type ( - &td->details.age_withdraw_commitments.reserve_sig), + &td->details.age_withdraw.reserve_sig), GNUNET_PQ_query_param_uint32 ( - &td->details.age_withdraw_commitments.noreveal_index), - GNUNET_PQ_query_param_absolute_time ( - &td->details.age_withdraw_commitments.timestamp), + &td->details.age_withdraw.noreveal_index), + /* TODO: other fields, too! */ GNUNET_PQ_query_param_end }; PREPARE (pg, - "insert_into_table_age_withdraw_commitments", - "INSERT INTO age_withdraw_commitments" + "insert_into_table_age_withdraw", + "INSERT INTO age_withdraw" "(age_withdraw_commitment_id" ",h_commitment" ",amount_with_fee_val" @@ -2097,64 +2096,10 @@ irbt_cb_table_age_withdraw_commitments (struct PostgresClosure *pg, ",reserve_pub" ",reserve_sig" ",noreveal_index" - ",timestamp" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_into_table_age_withdraw_commitments", - params); -} - - -/** - * Function called with age_withdraw_revealed_coins records to insert into table. - * - * @param pg plugin context - * @param td record to insert - */ -static enum GNUNET_DB_QueryStatus -irbt_cb_table_age_withdraw_revealed_coins (struct PostgresClosure *pg, - const struct - TALER_EXCHANGEDB_TableData *td) -{ - struct GNUNET_HashCode h_coin_ev; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&td->serial), - GNUNET_PQ_query_param_auto_from_type ( - &td->details.age_withdraw_revealed_coins.h_commitment), - GNUNET_PQ_query_param_uint32 ( - &td->details.age_withdraw_revealed_coins.freshcoin_index), - GNUNET_PQ_query_param_uint64 ( - &td->details.age_withdraw_revealed_coins.denominations_serial), - GNUNET_PQ_query_param_fixed_size ( - td->details.age_withdraw_revealed_coins.coin_ev, - td->details.age_withdraw_revealed_coins.coin_ev_size), - GNUNET_PQ_query_param_auto_from_type (&h_coin_ev), - TALER_PQ_query_param_blinded_denom_sig ( - &td->details.age_withdraw_revealed_coins.ev_sig), - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "insert_into_table_age_withdraw_revealed_coins", - "INSERT INTO age_withdraw_revealed_coins" - "(age_withdraw_revealed_coins_id" - ",h_commitment" - ",freshcoin_index" - ",denominations_serial" - ",coin_ev" - ",h_coin_ev" - ",ev_sig" - ",ewv" - ") VALUES " - "($1, $2, $3, $4, $5, $6, $7, $8);"); - - GNUNET_CRYPTO_hash (td->details.age_withdraw_revealed_coins.coin_ev, - td->details.age_withdraw_revealed_coins.coin_ev_size, - &h_coin_ev); - - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_into_table_age_withdraw_revealed_coins", + "insert_into_table_age_withdraw", params); } @@ -2306,11 +2251,8 @@ TEH_PG_insert_records_by_table (void *cls, case TALER_EXCHANGEDB_RT_PURSE_DELETION: rh = &irbt_cb_table_purse_deletion; break; - case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_COMMITMENTS: - rh = &irbt_cb_table_age_withdraw_commitments; - break; - case TALER_EXCHANGEDB_RT_WITHDRAW_AGE_REVEALED_COINS: - rh = &irbt_cb_table_age_withdraw_revealed_coins; + case TALER_EXCHANGEDB_RT_AGE_WITHDRAW: + rh = &irbt_cb_table_age_withdraw; break; } if (NULL == rh) |