LCOV - code coverage report
Current view: top level - auditordb - update_reserve_info.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 13 13
Test Date: 2026-09-09 15:11:34 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :    This file is part of TALER
       3              :    Copyright (C) 2022 Taler Systems SA
       4              : 
       5              :    TALER is free software; you can redistribute it and/or modify it under the
       6              :    terms of the GNU General Public License as published by the Free Software
       7              :    Foundation; either version 3, or (at your option) any later version.
       8              : 
       9              :    TALER is distributed in the hope that it will be useful, but WITHOUT ANY
      10              :    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      11              :    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
      12              : 
      13              :    You should have received a copy of the GNU General Public License along with
      14              :    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15              :  */
      16              : /**
      17              :  * @file update_reserve_info.c
      18              :  * @brief Low-level (statement-level) Postgres database access for the exchange
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "taler/taler_pq_lib.h"
      22              : #include "auditor-database/update_reserve_info.h"
      23              : #include "pg_helper.h"
      24              : 
      25              : 
      26              : enum GNUNET_DB_QueryStatus
      27            1 : TALER_AUDITORDB_update_reserve_info (
      28              :   struct TALER_AUDITORDB_PostgresContext *pg,
      29              :   const struct TALER_ReservePublicKeyP *reserve_pub,
      30              :   const struct TALER_AUDITORDB_ReserveFeeBalance *rfb,
      31              :   struct GNUNET_TIME_Timestamp expiration_date)
      32              : {
      33            1 :   struct GNUNET_PQ_QueryParam params[] = {
      34            1 :     TALER_PQ_query_param_amount (pg->conn,
      35              :                                  &rfb->reserve_balance),
      36            1 :     TALER_PQ_query_param_amount (pg->conn,
      37              :                                  &rfb->reserve_loss),
      38            1 :     TALER_PQ_query_param_amount (pg->conn,
      39              :                                  &rfb->withdraw_fee_balance),
      40            1 :     TALER_PQ_query_param_amount (pg->conn,
      41              :                                  &rfb->close_fee_balance),
      42            1 :     TALER_PQ_query_param_amount (pg->conn,
      43              :                                  &rfb->purse_fee_balance),
      44            1 :     TALER_PQ_query_param_amount (pg->conn,
      45              :                                  &rfb->open_fee_balance),
      46            1 :     TALER_PQ_query_param_amount (pg->conn,
      47              :                                  &rfb->history_fee_balance),
      48            1 :     GNUNET_PQ_query_param_timestamp (&expiration_date),
      49            1 :     GNUNET_PQ_query_param_auto_from_type (reserve_pub),
      50              :     GNUNET_PQ_query_param_end
      51              :   };
      52              : 
      53            1 :   PREPARE (pg,
      54              :            "update_reserve_info",
      55              :            "UPDATE auditor_reserves SET"
      56              :            " reserve_balance=$1"
      57              :            ",reserve_loss=$2"
      58              :            ",withdraw_fee_balance=$3"
      59              :            ",close_fee_balance=$4"
      60              :            ",purse_fee_balance=$5"
      61              :            ",open_fee_balance=$6"
      62              :            ",history_fee_balance=$7"
      63              :            ",expiration_date=$8"
      64              :            " WHERE reserve_pub=$9");
      65            1 :   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
      66              :                                              "update_reserve_info",
      67              :                                              params);
      68              : }
        

Generated by: LCOV version 2.0-1