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

Generated by: LCOV version 1.14