LCOV - code coverage report
Current view: top level - exchangedb - pg_lookup_denomination_key.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 17 100.0 %
Date: 2025-06-22 12:09:43 Functions: 1 1 100.0 %

          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/pg_lookup_denomination_key.c
      18             :  * @brief Implementation of the lookup_denomination_key function for Postgres
      19             :  * @author Christian Grothoff
      20             :  */
      21             : #include "taler/platform.h"
      22             : #include "taler/taler_error_codes.h"
      23             : #include "taler/taler_dbevents.h"
      24             : #include "taler/taler_pq_lib.h"
      25             : #include "pg_lookup_denomination_key.h"
      26             : #include "pg_helper.h"
      27             : 
      28             : enum GNUNET_DB_QueryStatus
      29       10248 : TEH_PG_lookup_denomination_key (
      30             :   void *cls,
      31             :   const struct TALER_DenominationHashP *h_denom_pub,
      32             :   struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta)
      33             : {
      34       10248 :   struct PostgresClosure *pg = cls;
      35       10248 :   struct GNUNET_PQ_QueryParam params[] = {
      36       10248 :     GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
      37             :     GNUNET_PQ_query_param_end
      38             :   };
      39       10248 :   struct GNUNET_PQ_ResultSpec rs[] = {
      40       10248 :     GNUNET_PQ_result_spec_timestamp ("valid_from",
      41             :                                      &meta->start),
      42       10248 :     GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
      43             :                                      &meta->expire_withdraw),
      44       10248 :     GNUNET_PQ_result_spec_timestamp ("expire_deposit",
      45             :                                      &meta->expire_deposit),
      46       10248 :     GNUNET_PQ_result_spec_timestamp ("expire_legal",
      47             :                                      &meta->expire_legal),
      48       10248 :     TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
      49             :                                  &meta->value),
      50       10248 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
      51             :                                  &meta->fees.withdraw),
      52       10248 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
      53             :                                  &meta->fees.deposit),
      54       10248 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
      55             :                                  &meta->fees.refresh),
      56       10248 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund",
      57             :                                  &meta->fees.refund),
      58       10248 :     GNUNET_PQ_result_spec_uint32 ("age_mask",
      59             :                                   &meta->age_mask.bits),
      60             :     GNUNET_PQ_result_spec_end
      61             :   };
      62             : 
      63       10248 :   PREPARE (pg,
      64             :            "lookup_denomination_key",
      65             :            "SELECT"
      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       10248 :   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
      79             :                                                    "lookup_denomination_key",
      80             :                                                    params,
      81             :                                                    rs);
      82             : }

Generated by: LCOV version 1.16