LCOV - code coverage report
Current view: top level - exchangedb - irbt_callbacks.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 155 213 72.8 %
Date: 2021-08-30 06:43:37 Functions: 14 21 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    This file is part of GNUnet
       3             :    Copyright (C) 2020 Taler Systems SA
       4             : 
       5             :    GNUnet is free software: you can redistribute it and/or modify it
       6             :    under the terms of the GNU Affero General Public License as published
       7             :    by the Free Software Foundation, either version 3 of the License,
       8             :    or (at your option) any later version.
       9             : 
      10             :    GNUnet is distributed in the hope that it will be useful, but
      11             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :    Affero General Public License for more details.
      14             : 
      15             :    You should have received a copy of the GNU Affero General Public License
      16             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      17             : 
      18             :      SPDX-License-Identifier: AGPL3.0-or-later
      19             :  */
      20             : /**
      21             :  * @file exchangedb/irbt_callbacks.c
      22             :  * @brief callbacks used by postgres_insert_records_by_table, to be
      23             :  *        inlined into the plugin
      24             :  * @author Christian Grothoff
      25             :  */
      26             : 
      27             : 
      28             : /**
      29             :  * Function called with denominations records to insert into table.
      30             :  *
      31             :  * @param pg plugin context
      32             :  * @param td record to insert
      33             :  */
      34             : static enum GNUNET_DB_QueryStatus
      35         424 : irbt_cb_table_denominations (struct PostgresClosure *pg,
      36             :                              const struct TALER_EXCHANGEDB_TableData *td)
      37             : {
      38             :   struct GNUNET_HashCode denom_hash;
      39         424 :   struct GNUNET_PQ_QueryParam params[] = {
      40         424 :     GNUNET_PQ_query_param_uint64 (&td->serial),
      41         424 :     GNUNET_PQ_query_param_auto_from_type (&denom_hash),
      42         424 :     GNUNET_PQ_query_param_rsa_public_key (
      43         424 :       td->details.denominations.denom_pub.rsa_public_key),
      44         424 :     GNUNET_PQ_query_param_auto_from_type (
      45             :       &td->details.denominations.master_sig),
      46         424 :     TALER_PQ_query_param_absolute_time (
      47             :       &td->details.denominations.valid_from),
      48         424 :     TALER_PQ_query_param_absolute_time (
      49             :       &td->details.denominations.expire_withdraw),
      50         424 :     TALER_PQ_query_param_absolute_time (
      51             :       &td->details.denominations.expire_deposit),
      52         424 :     TALER_PQ_query_param_absolute_time (
      53             :       &td->details.denominations.expire_legal),
      54         424 :     TALER_PQ_query_param_amount (&td->details.denominations.coin),
      55         424 :     TALER_PQ_query_param_amount (
      56             :       &td->details.denominations.fee_withdraw),
      57         424 :     TALER_PQ_query_param_amount (
      58             :       &td->details.denominations.fee_deposit),
      59         424 :     TALER_PQ_query_param_amount (
      60             :       &td->details.denominations.fee_refresh),
      61         424 :     TALER_PQ_query_param_amount (
      62             :       &td->details.denominations.fee_refund),
      63             :     GNUNET_PQ_query_param_end
      64             :   };
      65             : 
      66         424 :   GNUNET_CRYPTO_rsa_public_key_hash (
      67         424 :     td->details.denominations.denom_pub.rsa_public_key,
      68             :     &denom_hash);
      69             : 
      70         424 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
      71             :                                              "insert_into_table_denominations",
      72             :                                              params);
      73             : }
      74             : 
      75             : 
      76             : /**
      77             :  * Function called with denomination_revocations records to insert into table.
      78             :  *
      79             :  * @param pg plugin context
      80             :  * @param td record to insert
      81             :  */
      82             : static enum GNUNET_DB_QueryStatus
      83           0 : irbt_cb_table_denomination_revocations (
      84             :   struct PostgresClosure *pg,
      85             :   const struct TALER_EXCHANGEDB_TableData *td)
      86             : {
      87           0 :   struct GNUNET_PQ_QueryParam params[] = {
      88           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
      89           0 :     GNUNET_PQ_query_param_auto_from_type (
      90             :       &td->details.denomination_revocations.master_sig),
      91           0 :     GNUNET_PQ_query_param_uint64 (
      92             :       &td->details.denomination_revocations.denominations_serial),
      93             :     GNUNET_PQ_query_param_end
      94             :   };
      95             : 
      96           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
      97             :                                              "insert_into_table_denomination_revocations",
      98             :                                              params);
      99             : }
     100             : 
     101             : 
     102             : /**
     103             :  * Function called with reserves records to insert into table.
     104             :  *
     105             :  * @param pg plugin context
     106             :  * @param td record to insert
     107             :  */
     108             : static enum GNUNET_DB_QueryStatus
     109           2 : irbt_cb_table_reserves (struct PostgresClosure *pg,
     110             :                         const struct TALER_EXCHANGEDB_TableData *td)
     111             : {
     112           2 :   struct GNUNET_PQ_QueryParam params[] = {
     113           2 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     114           2 :     GNUNET_PQ_query_param_auto_from_type (&td->details.reserves.reserve_pub),
     115           2 :     GNUNET_PQ_query_param_string (td->details.reserves.account_details),
     116           2 :     TALER_PQ_query_param_amount (&td->details.reserves.current_balance),
     117           2 :     TALER_PQ_query_param_absolute_time (&td->details.reserves.expiration_date),
     118           2 :     TALER_PQ_query_param_absolute_time (&td->details.reserves.gc_date),
     119             :     GNUNET_PQ_query_param_end
     120             :   };
     121             : 
     122           2 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     123             :                                              "insert_into_table_reserves",
     124             :                                              params);
     125             : }
     126             : 
     127             : 
     128             : /**
     129             :  * Function called with reserves_in records to insert into table.
     130             :  *
     131             :  * @param pg plugin context
     132             :  * @param td record to insert
     133             :  */
     134             : static enum GNUNET_DB_QueryStatus
     135           2 : irbt_cb_table_reserves_in (struct PostgresClosure *pg,
     136             :                            const struct TALER_EXCHANGEDB_TableData *td)
     137             : {
     138           2 :   struct GNUNET_PQ_QueryParam params[] = {
     139           2 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     140           2 :     GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.wire_reference),
     141           2 :     TALER_PQ_query_param_amount (&td->details.reserves_in.credit),
     142           2 :     GNUNET_PQ_query_param_string (
     143           2 :       td->details.reserves_in.sender_account_details),
     144           2 :     GNUNET_PQ_query_param_string (
     145           2 :       td->details.reserves_in.exchange_account_section),
     146           2 :     TALER_PQ_query_param_absolute_time (
     147             :       &td->details.reserves_in.execution_date),
     148           2 :     GNUNET_PQ_query_param_uint64 (&td->details.reserves_in.reserve_uuid),
     149             :     GNUNET_PQ_query_param_end
     150             :   };
     151             : 
     152           2 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     153             :                                              "insert_into_table_reserves_in",
     154             :                                              params);
     155             : }
     156             : 
     157             : 
     158             : /**
     159             :  * Function called with reserves_close records to insert into table.
     160             :  *
     161             :  * @param pg plugin context
     162             :  * @param td record to insert
     163             :  */
     164             : static enum GNUNET_DB_QueryStatus
     165           0 : irbt_cb_table_reserves_close (struct PostgresClosure *pg,
     166             :                               const struct TALER_EXCHANGEDB_TableData *td)
     167             : {
     168           0 :   struct GNUNET_PQ_QueryParam params[] = {
     169           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     170           0 :     TALER_PQ_query_param_absolute_time (
     171             :       &td->details.reserves_close.execution_date),
     172           0 :     GNUNET_PQ_query_param_auto_from_type (&td->details.reserves_close.wtid),
     173           0 :     GNUNET_PQ_query_param_string (td->details.reserves_close.receiver_account),
     174           0 :     TALER_PQ_query_param_amount (&td->details.reserves_close.amount),
     175           0 :     TALER_PQ_query_param_amount (&td->details.reserves_close.closing_fee),
     176           0 :     GNUNET_PQ_query_param_uint64 (&td->details.reserves_close.reserve_uuid),
     177             :     GNUNET_PQ_query_param_end
     178             :   };
     179             : 
     180           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     181             :                                              "insert_into_table_reserves_close",
     182             :                                              params);
     183             : }
     184             : 
     185             : 
     186             : /**
     187             :  * Function called with reserves_out records to insert into table.
     188             :  *
     189             :  * @param pg plugin context
     190             :  * @param td record to insert
     191             :  */
     192             : static enum GNUNET_DB_QueryStatus
     193          26 : irbt_cb_table_reserves_out (struct PostgresClosure *pg,
     194             :                             const struct TALER_EXCHANGEDB_TableData *td)
     195             : {
     196          26 :   struct GNUNET_PQ_QueryParam params[] = {
     197          26 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     198          26 :     GNUNET_PQ_query_param_auto_from_type (&td->details.reserves_out.h_blind_ev),
     199          26 :     GNUNET_PQ_query_param_rsa_signature (
     200          26 :       td->details.reserves_out.denom_sig.rsa_signature),
     201          26 :     GNUNET_PQ_query_param_auto_from_type (
     202             :       &td->details.reserves_out.reserve_sig),
     203          26 :     TALER_PQ_query_param_absolute_time (
     204             :       &td->details.reserves_out.execution_date),
     205          26 :     TALER_PQ_query_param_amount (&td->details.reserves_out.amount_with_fee),
     206          26 :     GNUNET_PQ_query_param_uint64 (&td->details.reserves_out.reserve_uuid),
     207          26 :     GNUNET_PQ_query_param_uint64 (
     208             :       &td->details.reserves_out.denominations_serial),
     209             :     GNUNET_PQ_query_param_end
     210             :   };
     211             : 
     212          26 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     213             :                                              "insert_into_table_reserves_out",
     214             :                                              params);
     215             : }
     216             : 
     217             : 
     218             : /**
     219             :  * Function called with auditors records to insert into table.
     220             :  *
     221             :  * @param pg plugin context
     222             :  * @param td record to insert
     223             :  */
     224             : static enum GNUNET_DB_QueryStatus
     225           1 : irbt_cb_table_auditors (struct PostgresClosure *pg,
     226             :                         const struct TALER_EXCHANGEDB_TableData *td)
     227             : {
     228           1 :   uint8_t is_active = td->details.auditors.is_active ? 1 : 0;
     229           1 :   struct GNUNET_PQ_QueryParam params[] = {
     230           1 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     231           1 :     GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub),
     232           1 :     GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
     233           1 :     GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
     234           1 :     GNUNET_PQ_query_param_auto_from_type (&is_active),
     235           1 :     GNUNET_PQ_query_param_absolute_time (&td->details.auditors.last_change),
     236             :     GNUNET_PQ_query_param_end
     237             :   };
     238             : 
     239           1 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     240             :                                              "insert_into_table_auditors",
     241             :                                              params);
     242             : }
     243             : 
     244             : 
     245             : /**
     246             :  * Function called with auditor_denom_sigs records to insert into table.
     247             :  *
     248             :  * @param pg plugin context
     249             :  * @param td record to insert
     250             :  */
     251             : static enum GNUNET_DB_QueryStatus
     252         424 : irbt_cb_table_auditor_denom_sigs (struct PostgresClosure *pg,
     253             :                                   const struct TALER_EXCHANGEDB_TableData *td)
     254             : {
     255         424 :   struct GNUNET_PQ_QueryParam params[] = {
     256         424 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     257         424 :     GNUNET_PQ_query_param_uint64 (&td->details.auditor_denom_sigs.auditor_uuid),
     258         424 :     GNUNET_PQ_query_param_uint64 (
     259             :       &td->details.auditor_denom_sigs.denominations_serial),
     260         424 :     GNUNET_PQ_query_param_auto_from_type (
     261             :       &td->details.auditor_denom_sigs.auditor_sig),
     262             :     GNUNET_PQ_query_param_end
     263             :   };
     264             : 
     265         424 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     266             :                                              "insert_into_table_auditor_denom_sigs",
     267             :                                              params);
     268             : }
     269             : 
     270             : 
     271             : /**
     272             :  * Function called with exchange_sign_keys records to insert into table.
     273             :  *
     274             :  * @param pg plugin context
     275             :  * @param td record to insert
     276             :  */
     277             : static enum GNUNET_DB_QueryStatus
     278           5 : irbt_cb_table_exchange_sign_keys (struct PostgresClosure *pg,
     279             :                                   const struct TALER_EXCHANGEDB_TableData *td)
     280             : {
     281           5 :   struct GNUNET_PQ_QueryParam params[] = {
     282           5 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     283           5 :     GNUNET_PQ_query_param_auto_from_type (
     284             :       &td->details.exchange_sign_keys.exchange_pub),
     285           5 :     GNUNET_PQ_query_param_auto_from_type (
     286             :       &td->details.exchange_sign_keys.master_sig),
     287           5 :     TALER_PQ_query_param_absolute_time (
     288             :       &td->details.exchange_sign_keys.meta.start),
     289           5 :     TALER_PQ_query_param_absolute_time (
     290             :       &td->details.exchange_sign_keys.meta.expire_sign),
     291           5 :     TALER_PQ_query_param_absolute_time (
     292             :       &td->details.exchange_sign_keys.meta.expire_legal),
     293             :     GNUNET_PQ_query_param_end
     294             :   };
     295             : 
     296           5 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     297             :                                              "insert_into_table_exchange_sign_keys",
     298             :                                              params);
     299             : }
     300             : 
     301             : 
     302             : /**
     303             :  * Function called with signkey_revocations records to insert into table.
     304             :  *
     305             :  * @param pg plugin context
     306             :  * @param td record to insert
     307             :  */
     308             : static enum GNUNET_DB_QueryStatus
     309           0 : irbt_cb_table_signkey_revocations (struct PostgresClosure *pg,
     310             :                                    const struct TALER_EXCHANGEDB_TableData *td)
     311             : {
     312           0 :   struct GNUNET_PQ_QueryParam params[] = {
     313           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     314           0 :     GNUNET_PQ_query_param_uint64 (&td->details.signkey_revocations.esk_serial),
     315           0 :     GNUNET_PQ_query_param_auto_from_type (
     316             :       &td->details.signkey_revocations.master_sig),
     317             :     GNUNET_PQ_query_param_end
     318             :   };
     319             : 
     320           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     321             :                                              "insert_into_table_signkey_revocations",
     322             :                                              params);
     323             : }
     324             : 
     325             : 
     326             : /**
     327             :  * Function called with known_coins records to insert into table.
     328             :  *
     329             :  * @param pg plugin context
     330             :  * @param td record to insert
     331             :  */
     332             : static enum GNUNET_DB_QueryStatus
     333           3 : irbt_cb_table_known_coins (struct PostgresClosure *pg,
     334             :                            const struct TALER_EXCHANGEDB_TableData *td)
     335             : {
     336           3 :   struct GNUNET_PQ_QueryParam params[] = {
     337           3 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     338           3 :     GNUNET_PQ_query_param_auto_from_type (&td->details.known_coins.coin_pub),
     339           3 :     GNUNET_PQ_query_param_rsa_signature (
     340           3 :       td->details.known_coins.denom_sig.rsa_signature),
     341           3 :     GNUNET_PQ_query_param_uint64 (
     342             :       &td->details.known_coins.denominations_serial),
     343             :     GNUNET_PQ_query_param_end
     344             :   };
     345             : 
     346           3 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     347             :                                              "insert_into_table_known_coins",
     348             :                                              params);
     349             : }
     350             : 
     351             : 
     352             : /**
     353             :  * Function called with refresh_commitments records to insert into table.
     354             :  *
     355             :  * @param pg plugin context
     356             :  * @param td record to insert
     357             :  */
     358             : static enum GNUNET_DB_QueryStatus
     359           4 : irbt_cb_table_refresh_commitments (struct PostgresClosure *pg,
     360             :                                    const struct TALER_EXCHANGEDB_TableData *td)
     361             : {
     362           4 :   struct GNUNET_PQ_QueryParam params[] = {
     363           4 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     364           4 :     GNUNET_PQ_query_param_auto_from_type (&td->details.refresh_commitments.rc),
     365           4 :     GNUNET_PQ_query_param_auto_from_type (
     366             :       &td->details.refresh_commitments.old_coin_sig),
     367           4 :     TALER_PQ_query_param_amount (
     368             :       &td->details.refresh_commitments.amount_with_fee),
     369           4 :     GNUNET_PQ_query_param_uint32 (
     370             :       &td->details.refresh_commitments.noreveal_index),
     371           4 :     GNUNET_PQ_query_param_uint64 (
     372             :       &td->details.refresh_commitments.old_known_coin_id),
     373             :     GNUNET_PQ_query_param_end
     374             :   };
     375             : 
     376           4 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     377             :                                              "insert_into_table_refresh_commitments",
     378             :                                              params);
     379             : }
     380             : 
     381             : 
     382             : /**
     383             :  * Function called with refresh_revealed_coins records to insert into table.
     384             :  *
     385             :  * @param pg plugin context
     386             :  * @param td record to insert
     387             :  */
     388             : static enum GNUNET_DB_QueryStatus
     389          48 : irbt_cb_table_refresh_revealed_coins (
     390             :   struct PostgresClosure *pg,
     391             :   const struct TALER_EXCHANGEDB_TableData *td)
     392             : {
     393             :   struct GNUNET_HashCode h_coin_ev;
     394          48 :   struct GNUNET_PQ_QueryParam params[] = {
     395          48 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     396          48 :     GNUNET_PQ_query_param_uint32 (
     397             :       &td->details.refresh_revealed_coins.freshcoin_index),
     398          48 :     GNUNET_PQ_query_param_auto_from_type (
     399             :       &td->details.refresh_revealed_coins.link_sig),
     400          48 :     GNUNET_PQ_query_param_fixed_size (
     401          48 :       td->details.refresh_revealed_coins.coin_ev,
     402             :       td->details.refresh_revealed_coins.
     403             :       coin_ev_size),
     404          48 :     GNUNET_PQ_query_param_auto_from_type (&h_coin_ev),
     405          48 :     GNUNET_PQ_query_param_rsa_signature (
     406          48 :       td->details.refresh_revealed_coins.ev_sig.rsa_signature),
     407          48 :     GNUNET_PQ_query_param_uint64 (
     408             :       &td->details.refresh_revealed_coins.denominations_serial),
     409          48 :     GNUNET_PQ_query_param_uint64 (
     410             :       &td->details.refresh_revealed_coins.melt_serial_id),
     411             :     GNUNET_PQ_query_param_end
     412             :   };
     413             : 
     414          48 :   GNUNET_CRYPTO_hash (td->details.refresh_revealed_coins.coin_ev,
     415             :                       td->details.refresh_revealed_coins.coin_ev_size,
     416             :                       &h_coin_ev);
     417          48 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     418             :                                              "insert_into_table_refresh_revealed_coins",
     419             :                                              params);
     420             : }
     421             : 
     422             : 
     423             : /**
     424             :  * Function called with refresh_transfer_keys records to insert into table.
     425             :  *
     426             :  * @param pg plugin context
     427             :  * @param td record to insert
     428             :  */
     429             : static enum GNUNET_DB_QueryStatus
     430           4 : irbt_cb_table_refresh_transfer_keys (
     431             :   struct PostgresClosure *pg,
     432             :   const struct TALER_EXCHANGEDB_TableData *td)
     433             : {
     434           4 :   struct GNUNET_PQ_QueryParam params[] = {
     435           4 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     436           4 :     GNUNET_PQ_query_param_auto_from_type (
     437             :       &td->details.refresh_transfer_keys.tp),
     438           4 :     GNUNET_PQ_query_param_fixed_size (
     439           4 :       &td->details.refresh_transfer_keys.tprivs[0],
     440             :       (TALER_CNC_KAPPA - 1)
     441             :       * sizeof (struct TALER_TransferPrivateKeyP)),
     442           4 :     GNUNET_PQ_query_param_uint64 (
     443             :       &td->details.refresh_transfer_keys.melt_serial_id),
     444             :     GNUNET_PQ_query_param_end
     445             :   };
     446             : 
     447           4 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     448             :                                              "insert_into_table_refresh_transfer_keys",
     449             :                                              params);
     450             : }
     451             : 
     452             : 
     453             : /**
     454             :  * Function called with deposits records to insert into table.
     455             :  *
     456             :  * @param pg plugin context
     457             :  * @param td record to insert
     458             :  */
     459             : static enum GNUNET_DB_QueryStatus
     460           3 : irbt_cb_table_deposits (struct PostgresClosure *pg,
     461             :                         const struct TALER_EXCHANGEDB_TableData *td)
     462             : {
     463           3 :   uint8_t tiny = td->details.deposits.tiny ? 1 : 0;
     464           3 :   uint8_t done = td->details.deposits.done ? 1 : 0;
     465             :   struct GNUNET_HashCode h_wire;
     466           3 :   struct GNUNET_PQ_QueryParam params[] = {
     467           3 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     468           3 :     TALER_PQ_query_param_amount (&td->details.deposits.amount_with_fee),
     469           3 :     TALER_PQ_query_param_absolute_time (&td->details.deposits.wallet_timestamp),
     470           3 :     TALER_PQ_query_param_absolute_time (
     471             :       &td->details.deposits.exchange_timestamp),
     472           3 :     TALER_PQ_query_param_absolute_time (&td->details.deposits.refund_deadline),
     473           3 :     TALER_PQ_query_param_absolute_time (&td->details.deposits.wire_deadline),
     474           3 :     GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.merchant_pub),
     475           3 :     GNUNET_PQ_query_param_auto_from_type (
     476             :       &td->details.deposits.h_contract_terms),
     477           3 :     GNUNET_PQ_query_param_auto_from_type (&h_wire),
     478           3 :     GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig),
     479           3 :     TALER_PQ_query_param_json (td->details.deposits.wire),
     480           3 :     GNUNET_PQ_query_param_auto_from_type (&tiny),
     481           3 :     GNUNET_PQ_query_param_auto_from_type (&done),
     482           3 :     GNUNET_PQ_query_param_uint64 (&td->details.deposits.known_coin_id),
     483             :     GNUNET_PQ_query_param_end
     484             :   };
     485             : 
     486           3 :   TALER_JSON_merchant_wire_signature_hash (td->details.deposits.wire,
     487             :                                            &h_wire);
     488           3 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     489             :                                              "insert_into_table_deposits",
     490             :                                              params);
     491             : }
     492             : 
     493             : 
     494             : /**
     495             :  * Function called with refunds records to insert into table.
     496             :  *
     497             :  * @param pg plugin context
     498             :  * @param td record to insert
     499             :  */
     500             : static enum GNUNET_DB_QueryStatus
     501           1 : irbt_cb_table_refunds (struct PostgresClosure *pg,
     502             :                        const struct TALER_EXCHANGEDB_TableData *td)
     503             : {
     504           1 :   struct GNUNET_PQ_QueryParam params[] = {
     505           1 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     506           1 :     GNUNET_PQ_query_param_auto_from_type (&td->details.refunds.merchant_sig),
     507           1 :     GNUNET_PQ_query_param_uint64 (&td->details.refunds.rtransaction_id),
     508           1 :     TALER_PQ_query_param_amount (&td->details.refunds.amount_with_fee),
     509           1 :     GNUNET_PQ_query_param_uint64 (&td->details.refunds.deposit_serial_id),
     510             :     GNUNET_PQ_query_param_end
     511             :   };
     512             : 
     513           1 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     514             :                                              "insert_into_table_refunds",
     515             :                                              params);
     516             : }
     517             : 
     518             : 
     519             : /**
     520             :  * Function called with wire_out records to insert into table.
     521             :  *
     522             :  * @param pg plugin context
     523             :  * @param td record to insert
     524             :  */
     525             : static enum GNUNET_DB_QueryStatus
     526           0 : irbt_cb_table_wire_out (struct PostgresClosure *pg,
     527             :                         const struct TALER_EXCHANGEDB_TableData *td)
     528             : {
     529           0 :   struct GNUNET_PQ_QueryParam params[] = {
     530           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     531           0 :     TALER_PQ_query_param_absolute_time (&td->details.wire_out.execution_date),
     532           0 :     GNUNET_PQ_query_param_auto_from_type (&td->details.wire_out.wtid_raw),
     533           0 :     TALER_PQ_query_param_json (td->details.wire_out.wire_target),
     534           0 :     GNUNET_PQ_query_param_string (
     535           0 :       td->details.wire_out.exchange_account_section),
     536           0 :     TALER_PQ_query_param_amount (&td->details.wire_out.amount),
     537             :     GNUNET_PQ_query_param_end
     538             :   };
     539             : 
     540           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     541             :                                              "insert_into_table_wire_out",
     542             :                                              params);
     543             : }
     544             : 
     545             : 
     546             : /**
     547             :  * Function called with aggregation_tracking records to insert into table.
     548             :  *
     549             :  * @param pg plugin context
     550             :  * @param td record to insert
     551             :  */
     552             : static enum GNUNET_DB_QueryStatus
     553           0 : irbt_cb_table_aggregation_tracking (struct PostgresClosure *pg,
     554             :                                     const struct TALER_EXCHANGEDB_TableData *td)
     555             : {
     556           0 :   struct GNUNET_PQ_QueryParam params[] = {
     557           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     558           0 :     GNUNET_PQ_query_param_uint64 (
     559             :       &td->details.aggregation_tracking.deposit_serial_id),
     560           0 :     GNUNET_PQ_query_param_auto_from_type (
     561             :       &td->details.aggregation_tracking.wtid_raw),
     562             :     GNUNET_PQ_query_param_end
     563             :   };
     564             : 
     565           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     566             :                                              "insert_into_table_aggregation_tracking",
     567             :                                              params);
     568             : }
     569             : 
     570             : 
     571             : /**
     572             :  * Function called with wire_fee records to insert into table.
     573             :  *
     574             :  * @param pg plugin context
     575             :  * @param td record to insert
     576             :  */
     577             : static enum GNUNET_DB_QueryStatus
     578           1 : irbt_cb_table_wire_fee (struct PostgresClosure *pg,
     579             :                         const struct TALER_EXCHANGEDB_TableData *td)
     580             : {
     581           1 :   struct GNUNET_PQ_QueryParam params[] = {
     582           1 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     583           1 :     GNUNET_PQ_query_param_string (td->details.wire_fee.wire_method),
     584           1 :     TALER_PQ_query_param_absolute_time (&td->details.wire_fee.start_date),
     585           1 :     TALER_PQ_query_param_absolute_time (&td->details.wire_fee.end_date),
     586           1 :     TALER_PQ_query_param_amount (&td->details.wire_fee.wire_fee),
     587           1 :     TALER_PQ_query_param_amount (&td->details.wire_fee.closing_fee),
     588           1 :     GNUNET_PQ_query_param_auto_from_type (&td->details.wire_fee.master_sig),
     589             :     GNUNET_PQ_query_param_end
     590             :   };
     591             : 
     592           1 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     593             :                                              "insert_into_table_wire_fee",
     594             :                                              params);
     595             : }
     596             : 
     597             : 
     598             : /**
     599             :  * Function called with recoup records to insert into table.
     600             :  *
     601             :  * @param pg plugin context
     602             :  * @param td record to insert
     603             :  */
     604             : static enum GNUNET_DB_QueryStatus
     605           0 : irbt_cb_table_recoup (struct PostgresClosure *pg,
     606             :                       const struct TALER_EXCHANGEDB_TableData *td)
     607             : {
     608           0 :   struct GNUNET_PQ_QueryParam params[] = {
     609           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     610           0 :     GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_sig),
     611           0 :     GNUNET_PQ_query_param_auto_from_type (&td->details.recoup.coin_blind),
     612           0 :     TALER_PQ_query_param_amount (&td->details.recoup.amount),
     613           0 :     TALER_PQ_query_param_absolute_time (&td->details.recoup.timestamp),
     614           0 :     GNUNET_PQ_query_param_uint64 (&td->details.recoup.known_coin_id),
     615           0 :     GNUNET_PQ_query_param_uint64 (&td->details.recoup.reserve_out_serial_id),
     616             :     GNUNET_PQ_query_param_end
     617             :   };
     618             : 
     619           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     620             :                                              "insert_into_table_recoup",
     621             :                                              params);
     622             : }
     623             : 
     624             : 
     625             : /**
     626             :  * Function called with recoup_refresh records to insert into table.
     627             :  *
     628             :  * @param pg plugin context
     629             :  * @param td record to insert
     630             :  */
     631             : static enum GNUNET_DB_QueryStatus
     632           0 : irbt_cb_table_recoup_refresh (struct PostgresClosure *pg,
     633             :                               const struct TALER_EXCHANGEDB_TableData *td)
     634             : {
     635           0 :   struct GNUNET_PQ_QueryParam params[] = {
     636           0 :     GNUNET_PQ_query_param_uint64 (&td->serial),
     637           0 :     GNUNET_PQ_query_param_auto_from_type (&td->details.recoup_refresh.coin_sig),
     638           0 :     GNUNET_PQ_query_param_auto_from_type (
     639             :       &td->details.recoup_refresh.coin_blind),
     640           0 :     TALER_PQ_query_param_amount (&td->details.recoup_refresh.amount),
     641           0 :     TALER_PQ_query_param_absolute_time (&td->details.recoup_refresh.timestamp),
     642           0 :     GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.known_coin_id),
     643           0 :     GNUNET_PQ_query_param_uint64 (&td->details.recoup_refresh.rrc_serial),
     644             :     GNUNET_PQ_query_param_end
     645             :   };
     646             : 
     647           0 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
     648             :                                              "insert_into_table_recoup_refresh",
     649             :                                              params);
     650             : }
     651             : 
     652             : 
     653             : /* end of irbt_callbacks.c */

Generated by: LCOV version 1.14