LCOV - code coverage report
Current view: top level - exchangedb - lookup_denomination_key.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2026-04-14 15:39:31 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 exchangedb/lookup_denomination_key.c
      18              :  * @brief Implementation of the lookup_denomination_key function for Postgres
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "taler/taler_error_codes.h"
      22              : #include "taler/taler_pq_lib.h"
      23              : #include "exchange-database/lookup_denomination_key.h"
      24              : #include "helper.h"
      25              : 
      26              : enum GNUNET_DB_QueryStatus
      27          709 : TALER_EXCHANGEDB_lookup_denomination_key (
      28              :   struct TALER_EXCHANGEDB_PostgresContext *pg,
      29              :   const struct TALER_DenominationHashP *h_denom_pub,
      30              :   struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta)
      31              : {
      32          709 :   struct GNUNET_PQ_QueryParam params[] = {
      33          709 :     GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
      34              :     GNUNET_PQ_query_param_end
      35              :   };
      36          709 :   struct GNUNET_PQ_ResultSpec rs[] = {
      37          709 :     GNUNET_PQ_result_spec_timestamp ("valid_from",
      38              :                                      &meta->start),
      39          709 :     GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
      40              :                                      &meta->expire_withdraw),
      41          709 :     GNUNET_PQ_result_spec_timestamp ("expire_deposit",
      42              :                                      &meta->expire_deposit),
      43          709 :     GNUNET_PQ_result_spec_timestamp ("expire_legal",
      44              :                                      &meta->expire_legal),
      45          709 :     TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
      46              :                                  &meta->value),
      47          709 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
      48              :                                  &meta->fees.withdraw),
      49          709 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
      50              :                                  &meta->fees.deposit),
      51          709 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
      52              :                                  &meta->fees.refresh),
      53          709 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund",
      54              :                                  &meta->fees.refund),
      55          709 :     GNUNET_PQ_result_spec_uint32 ("age_mask",
      56              :                                   &meta->age_mask.bits),
      57              :     GNUNET_PQ_result_spec_end
      58              :   };
      59              : 
      60          709 :   PREPARE (pg,
      61              :            "lookup_denomination_key",
      62              :            "SELECT"
      63              :            " valid_from"
      64              :            ",expire_withdraw"
      65              :            ",expire_deposit"
      66              :            ",expire_legal"
      67              :            ",coin"
      68              :            ",fee_withdraw"
      69              :            ",fee_deposit"
      70              :            ",fee_refresh"
      71              :            ",fee_refund"
      72              :            ",age_mask"
      73              :            " FROM denominations"
      74              :            " WHERE denom_pub_hash=$1;");
      75          709 :   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
      76              :                                                    "lookup_denomination_key",
      77              :                                                    params,
      78              :                                                    rs);
      79              : }
        

Generated by: LCOV version 2.0-1