LCOV - code coverage report
Current view: top level - exchangedb - pg_insert_sanction_list_hit.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 27 0
Test Date: 2025-12-28 14:06:02 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 exchangedb/pg_insert_sanction_list_hit.c
      18              :  * @brief Implementation of the insert_sanction_list_hit 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_insert_sanction_list_hit.h"
      26              : #include "pg_helper.h"
      27              : 
      28              : 
      29              : enum GNUNET_DB_QueryStatus
      30            0 : TEH_PG_insert_sanction_list_hit (
      31              :   void *cls,
      32              :   const struct TALER_NormalizedPaytoHashP *h_payto,
      33              :   bool to_investigate,
      34              :   const json_t *new_rules,
      35              :   const json_t *account_properties,
      36              :   unsigned int num_events,
      37              :   const char **events)
      38              : {
      39            0 :   struct PostgresClosure *pg = cls;
      40            0 :   struct GNUNET_TIME_Timestamp never
      41              :     = GNUNET_TIME_UNIT_FOREVER_TS;
      42              :   struct GNUNET_TIME_Timestamp now
      43            0 :     = GNUNET_TIME_timestamp_get ();
      44            0 :   struct TALER_KycCompletedEventP rep = {
      45            0 :     .header.size = htons (sizeof (rep)),
      46            0 :     .header.type = htons (TALER_DBEVENT_EXCHANGE_KYC_COMPLETED),
      47              :     .h_payto = *h_payto
      48              :   };
      49              :   char *notify_s
      50            0 :     = GNUNET_PQ_get_event_notify_channel (&rep.header);
      51            0 :   struct GNUNET_PQ_QueryParam params[] = {
      52            0 :     GNUNET_PQ_query_param_auto_from_type (h_payto),
      53            0 :     GNUNET_PQ_query_param_timestamp (&now),
      54            0 :     GNUNET_PQ_query_param_timestamp (&never),
      55              :     NULL != account_properties
      56            0 :     ? TALER_PQ_query_param_json (account_properties)
      57            0 :     : GNUNET_PQ_query_param_null (),
      58              :     NULL != new_rules
      59            0 :     ? TALER_PQ_query_param_json (new_rules)
      60            0 :     : GNUNET_PQ_query_param_null (),
      61            0 :     GNUNET_PQ_query_param_bool (to_investigate),
      62            0 :     GNUNET_PQ_query_param_string (notify_s),
      63            0 :     GNUNET_PQ_query_param_array_ptrs_string (num_events,
      64              :                                              events,
      65              :                                              pg->conn),
      66              :     GNUNET_PQ_query_param_end
      67              :   };
      68              :   uint64_t outcome_serial_id;
      69            0 :   struct GNUNET_PQ_ResultSpec rs[] = {
      70            0 :     GNUNET_PQ_result_spec_uint64 ("outcome_serial_id",
      71              :                                   &outcome_serial_id),
      72              :     GNUNET_PQ_result_spec_end
      73              :   };
      74              :   enum GNUNET_DB_QueryStatus qs;
      75              : 
      76            0 :   PREPARE (pg,
      77              :            "do_insert_sanction_list_hit",
      78              :            "SELECT"
      79              :            " out_outcome_serial_id AS outcome_serial_id"
      80              :            " FROM exchange_do_insert_sanction_list_hit"
      81              :            "($1,$2,$3,$4,$5,$6,$7,$8);");
      82            0 :   qs = GNUNET_PQ_eval_prepared_singleton_select (
      83              :     pg->conn,
      84              :     "do_insert_sanction_list_hit",
      85              :     params,
      86              :     rs);
      87              :   (void) outcome_serial_id;
      88            0 :   GNUNET_PQ_cleanup_query_params_closures (params);
      89            0 :   GNUNET_free (notify_s);
      90            0 :   GNUNET_PQ_event_do_poll (pg->conn);
      91            0 :   return qs;
      92              : }
        

Generated by: LCOV version 2.0-1