LCOV - code coverage report
Current view: top level - backenddb - get_report.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 22 0
Test Date: 2026-09-04 23:42:01 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /*
       2              :    This file is part of TALER
       3              :    Copyright (C) 2025 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 src/backenddb/get_report.c
      18              :  * @brief Implementation of the get_report function for Postgres
      19              :  * @author Christian Grothoff
      20              :  */
      21              : #include "platform.h"
      22              : #include <taler/taler_pq_lib.h>
      23              : #include "merchant-database/get_report.h"
      24              : #include "helper.h"
      25              : 
      26              : 
      27              : enum GNUNET_DB_QueryStatus
      28            0 : TALER_MERCHANTDB_get_report (
      29              :   struct TALER_MERCHANTDB_PostgresContext *pg,
      30              :   const char *instance_id,
      31              :   uint64_t report_id,
      32              :   char **report_program_section,
      33              :   char **report_description,
      34              :   char **mime_type,
      35              :   char **data_source,
      36              :   char **target_address,
      37              :   struct GNUNET_TIME_Relative *frequency,
      38              :   struct GNUNET_TIME_Relative *frequency_shift,
      39              :   struct GNUNET_TIME_Absolute *next_transmission,
      40              :   enum TALER_ErrorCode *last_error_code,
      41              :   char **last_error_detail)
      42              : {
      43            0 :   struct GNUNET_PQ_QueryParam params[] = {
      44            0 :     GNUNET_PQ_query_param_uint64 (&report_id),
      45              :     GNUNET_PQ_query_param_end
      46              :   };
      47              :   uint32_t code;
      48            0 :   struct GNUNET_PQ_ResultSpec rs[] = {
      49            0 :     GNUNET_PQ_result_spec_string ("report_program_section",
      50              :                                   report_program_section),
      51            0 :     GNUNET_PQ_result_spec_string ("report_description",
      52              :                                   report_description),
      53            0 :     GNUNET_PQ_result_spec_string ("mime_type",
      54              :                                   mime_type),
      55            0 :     GNUNET_PQ_result_spec_string ("data_source",
      56              :                                   data_source),
      57            0 :     GNUNET_PQ_result_spec_string ("target_address",
      58              :                                   target_address),
      59            0 :     GNUNET_PQ_result_spec_relative_time ("frequency",
      60              :                                          frequency),
      61            0 :     GNUNET_PQ_result_spec_relative_time ("frequency_shift",
      62              :                                          frequency_shift),
      63            0 :     GNUNET_PQ_result_spec_absolute_time ("next_transmission",
      64              :                                          next_transmission),
      65            0 :     GNUNET_PQ_result_spec_allow_null (
      66              :       GNUNET_PQ_result_spec_uint32 ("last_error_code",
      67              :                                     &code),
      68              :       NULL),
      69            0 :     GNUNET_PQ_result_spec_allow_null (
      70              :       GNUNET_PQ_result_spec_string ("last_error_detail",
      71              :                                     last_error_detail),
      72              :       NULL),
      73              :     GNUNET_PQ_result_spec_end
      74              :   };
      75              :   enum GNUNET_DB_QueryStatus qs;
      76              : 
      77            0 :   GNUNET_assert (NULL != pg->current_merchant_id);
      78            0 :   GNUNET_assert (0 == strcmp (instance_id,
      79              :                               pg->current_merchant_id));
      80            0 :   *last_error_detail = NULL;
      81            0 :   code = TALER_EC_NONE;
      82            0 :   TMH_PQ_prepare_anon (pg,
      83              :                        "SELECT"
      84              :                        "  report_program_section"
      85              :                        " ,report_description"
      86              :                        " ,mime_type"
      87              :                        " ,data_source"
      88              :                        " ,target_address"
      89              :                        " ,frequency"
      90              :                        " ,frequency_shift"
      91              :                        " ,next_transmission"
      92              :                        " ,last_error_code"
      93              :                        " ,last_error_detail"
      94              :                        " FROM merchant_reports"
      95              :                        " WHERE report_serial=$1;");
      96            0 :   qs = GNUNET_PQ_eval_prepared_singleton_select (
      97              :     pg->conn,
      98              :     "",
      99              :     params,
     100              :     rs);
     101            0 :   *last_error_code = (enum TALER_ErrorCode) code;
     102            0 :   return qs;
     103              : }
        

Generated by: LCOV version 2.0-1