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

Generated by: LCOV version 2.0-1