Line data Source code
1 : /* 2 : This file is part of TALER 3 : Copyright (C) 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 auditordb/pg_select_reserve_in_inconsistency.c 18 : * @brief Implementation of the select_reserve_in_inconsistency function for Postgres 19 : * @author Christian Grothoff 20 : */ 21 : #include "platform.h" 22 : #include "taler_error_codes.h" 23 : #include "taler_dbevents.h" 24 : #include "taler_pq_lib.h" 25 : #include "pg_select_reserve_in_inconsistency.h" 26 : #include "pg_helper.h" 27 : 28 : 29 : enum GNUNET_DB_QueryStatus 30 68 : TAH_PG_select_reserve_in_inconsistency ( 31 : void *cls, 32 : uint64_t bank_row_id, 33 : struct TALER_AUDITORDB_ReserveInInconsistency *dc) 34 : { 35 68 : struct PostgresClosure *pg = cls; 36 68 : struct GNUNET_PQ_QueryParam params[] = { 37 68 : GNUNET_PQ_query_param_uint64 (&bank_row_id), 38 : GNUNET_PQ_query_param_end 39 : }; 40 68 : struct GNUNET_PQ_ResultSpec rs[] = { 41 68 : GNUNET_PQ_result_spec_uint64 ("row_id", 42 : &dc->serial_id), 43 68 : TALER_PQ_RESULT_SPEC_AMOUNT ("amount_exchange_expected", 44 : &dc->amount_exchange_expected), 45 68 : TALER_PQ_RESULT_SPEC_AMOUNT ("amount_wired", 46 : &dc->amount_wired), 47 68 : GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", 48 : &dc->reserve_pub), 49 68 : GNUNET_PQ_result_spec_absolute_time ("timestamp", 50 : &dc->timestamp), 51 68 : GNUNET_PQ_result_spec_string ("account", 52 : &dc->account.full_payto), 53 68 : GNUNET_PQ_result_spec_string ("diagnostic", 54 : &dc->diagnostic), 55 68 : GNUNET_PQ_result_spec_bool ("suppressed", 56 : &dc->suppressed), 57 : GNUNET_PQ_result_spec_end 58 : }; 59 : 60 68 : dc->bank_row_id = bank_row_id; 61 68 : PREPARE (pg, 62 : "select_reserve_in_inconsistency", 63 : "SELECT" 64 : " row_id" 65 : ",amount_exchange_expected" 66 : ",amount_wired" 67 : ",reserve_pub" 68 : ",timestamp" 69 : ",account" 70 : ",diagnostic" 71 : ",suppressed" 72 : " FROM auditor_reserve_in_inconsistency" 73 : " WHERE (bank_row_id = $1)" 74 : ); 75 68 : return GNUNET_PQ_eval_prepared_singleton_select ( 76 : pg->conn, 77 : "select_reserve_in_inconsistency", 78 : params, 79 : rs); 80 : }