LCOV - code coverage report
Current view: top level - exchangedb - pg_lookup_denomination_key.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 17 17
Test Date: 2026-01-04 22:17:00 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/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         8553 : TEH_PG_lookup_denomination_key (
      30              :   void *cls,
      31              :   const struct TALER_DenominationHashP *h_denom_pub,
      32              :   struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta)
      33              : {
      34         8553 :   struct PostgresClosure *pg = cls;
      35         8553 :   struct GNUNET_PQ_QueryParam params[] = {
      36         8553 :     GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
      37              :     GNUNET_PQ_query_param_end
      38              :   };
      39         8553 :   struct GNUNET_PQ_ResultSpec rs[] = {
      40         8553 :     GNUNET_PQ_result_spec_timestamp ("valid_from",
      41              :                                      &meta->start),
      42         8553 :     GNUNET_PQ_result_spec_timestamp ("expire_withdraw",
      43              :                                      &meta->expire_withdraw),
      44         8553 :     GNUNET_PQ_result_spec_timestamp ("expire_deposit",
      45              :                                      &meta->expire_deposit),
      46         8553 :     GNUNET_PQ_result_spec_timestamp ("expire_legal",
      47              :                                      &meta->expire_legal),
      48         8553 :     TALER_PQ_RESULT_SPEC_AMOUNT ("coin",
      49              :                                  &meta->value),
      50         8553 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_withdraw",
      51              :                                  &meta->fees.withdraw),
      52         8553 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
      53              :                                  &meta->fees.deposit),
      54         8553 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
      55              :                                  &meta->fees.refresh),
      56         8553 :     TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund",
      57              :                                  &meta->fees.refund),
      58         8553 :     GNUNET_PQ_result_spec_uint32 ("age_mask",
      59              :                                   &meta->age_mask.bits),
      60              :     GNUNET_PQ_result_spec_end
      61              :   };
      62              : 
      63         8553 :   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         8553 :   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
      79              :                                                    "lookup_denomination_key",
      80              :                                                    params,
      81              :                                                    rs);
      82              : }
        

Generated by: LCOV version 2.0-1