LCOV - code coverage report
Current view: top level - auditordb - pg.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 80.0 % 15 12
Test Date: 2026-04-14 15:39:31 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :   This file is part of TALER
       3              :   Copyright (C) 2014-2024 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 pg.c
      18              :  * @brief Low-level (statement-level) Postgres database access for the auditor
      19              :  * @author Christian Grothoff
      20              :  * @author Gabor X Toth
      21              :  */
      22              : #include "taler/taler_pq_lib.h"
      23              : #include <pthread.h>
      24              : #include <libpq-fe.h>
      25              : #include "taler/taler_auditordb_lib.h"
      26              : #include "pg_helper.h"
      27              : 
      28              : 
      29              : struct TALER_AUDITORDB_PostgresContext *
      30           32 : TALER_AUDITORDB_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
      31              :                          bool skip_preflight)
      32              : {
      33              :   struct TALER_AUDITORDB_PostgresContext *pg;
      34              : 
      35           32 :   pg = GNUNET_new (struct TALER_AUDITORDB_PostgresContext);
      36           32 :   pg->cfg = cfg;
      37           32 :   if (GNUNET_OK !=
      38           32 :       TALER_config_get_currency (cfg,
      39              :                                  "exchange",
      40              :                                  &pg->currency))
      41              :   {
      42            0 :     GNUNET_free (pg);
      43            0 :     return NULL;
      44              :   }
      45           32 :   return pg;
      46              : }
      47              : 
      48              : 
      49              : void
      50           32 : TALER_AUDITORDB_disconnect (struct TALER_AUDITORDB_PostgresContext *pg)
      51              : {
      52           32 :   if (NULL == pg)
      53            0 :     return;
      54           32 :   if (NULL != pg->conn)
      55           24 :     GNUNET_PQ_disconnect (pg->conn);
      56           32 :   GNUNET_free (pg->currency);
      57           32 :   GNUNET_free (pg);
      58              : }
      59              : 
      60              : 
      61              : /* end of plugin_auditordb_postgres.c */
        

Generated by: LCOV version 2.0-1