From 6e3d1bdc91254a5bd57d58e5280e20813211157b Mon Sep 17 00:00:00 2001 From: Joseph Date: Fri, 25 Nov 2022 06:09:20 -0500 Subject: some modifications for batch test --- src/exchangedb/pg_batch_reserves_in_insert.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/exchangedb/pg_batch_reserves_in_insert.c') diff --git a/src/exchangedb/pg_batch_reserves_in_insert.c b/src/exchangedb/pg_batch_reserves_in_insert.c index f40641edd..2e6487516 100644 --- a/src/exchangedb/pg_batch_reserves_in_insert.c +++ b/src/exchangedb/pg_batch_reserves_in_insert.c @@ -16,7 +16,7 @@ /** * @file exchangedb/pg_batch_reserves_in_insert.c * @brief Implementation of the reserves_in_insert function for Postgres - * @author Joseph XU + * @author Joseph Xu */ #include "platform.h" #include "taler_error_codes.h" @@ -32,6 +32,7 @@ #include "pg_reserves_update.h" #include "pg_setup_wire_target.h" #include "pg_event_notify.h" +#include "pg_preflight.h" /** @@ -73,6 +74,12 @@ TEH_PG_batch_reserves_in_insert (void *cls, bool conflicts[reserves_length]; char *notify_s[reserves_length]; + if (GNUNET_OK != + TEH_PG_preflight (pg)) + { + GNUNET_break (0); + return GNUNET_DB_STATUS_HARD_ERROR; + } PREPARE (pg, "reserve_create", "SELECT " @@ -143,11 +150,13 @@ TEH_PG_batch_reserves_in_insert (void *cls, TALER_payto_hash (reserve->sender_account_details, &h_payto); + /* Note: query uses 'on conflict do nothing' */ qs1 = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "reserve_create", params, rs); + if (qs1 < 0) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -160,6 +169,7 @@ TEH_PG_batch_reserves_in_insert (void *cls, ? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS : GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; conflicts[i] = conflicted; + // fprintf(stdout, "%d", conflicts[i]); if (!conflicts[i] && transaction_duplicate) { GNUNET_break (0); @@ -212,6 +222,7 @@ TEH_PG_batch_reserves_in_insert (void *cls, GNUNET_PQ_query_param_string (notify_s[i]), GNUNET_PQ_query_param_end }; + qs2 = GNUNET_PQ_eval_prepared_non_select (pg->conn, "reserves_in_add_transaction", params); -- cgit v1.2.3