diff options
author | Joseph <Joseph.xu@efrei.net> | 2022-11-25 06:09:20 -0500 |
---|---|---|
committer | Joseph <Joseph.xu@efrei.net> | 2022-12-06 08:09:45 -0500 |
commit | 6e3d1bdc91254a5bd57d58e5280e20813211157b (patch) | |
tree | 6b9a7cb73af409a57130f216acfea18199a329e5 /src/exchangedb/pg_batch_reserves_in_insert.c | |
parent | b6476ac881cfd3bde41c88b94f6a7538acf76f9c (diff) | |
download | exchange-6e3d1bdc91254a5bd57d58e5280e20813211157b.tar.gz exchange-6e3d1bdc91254a5bd57d58e5280e20813211157b.tar.bz2 exchange-6e3d1bdc91254a5bd57d58e5280e20813211157b.zip |
some modifications for batch test
Diffstat (limited to 'src/exchangedb/pg_batch_reserves_in_insert.c')
-rw-r--r-- | src/exchangedb/pg_batch_reserves_in_insert.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); |