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 : #include "platform.h" 17 : #include "taler_error_codes.h" 18 : #include "taler_dbevents.h" 19 : #include "taler_pq_lib.h" 20 : #include "pg_helper.h" 21 : #include "pg_lookup_reserve_in_inconsistency.h" 22 : 23 : 24 : enum GNUNET_DB_QueryStatus 25 0 : TAH_PG_lookup_reserve_in_inconsistency ( 26 : void *cls, 27 : uint64_t bank_row_id, 28 : struct TALER_AUDITORDB_ReserveInInconsistency *dc) 29 : { 30 0 : struct PostgresClosure *pg = cls; 31 0 : struct GNUNET_PQ_QueryParam params[] = { 32 0 : GNUNET_PQ_query_param_uint64 (&bank_row_id), 33 : GNUNET_PQ_query_param_end 34 : }; 35 0 : struct GNUNET_PQ_ResultSpec rs[] = { 36 0 : GNUNET_PQ_result_spec_uint64 ("row_id", 37 : &dc->serial_id), 38 0 : TALER_PQ_RESULT_SPEC_AMOUNT ("amount_exchange_expected", 39 : &dc->amount_exchange_expected), 40 0 : TALER_PQ_RESULT_SPEC_AMOUNT ("amount_wired", 41 : &dc->amount_wired), 42 0 : GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", 43 : &dc->reserve_pub), 44 0 : GNUNET_PQ_result_spec_absolute_time ("timestamp", 45 : &dc->timestamp), 46 0 : GNUNET_PQ_result_spec_string ("account", 47 : &dc->account.full_payto), 48 0 : GNUNET_PQ_result_spec_string ("diagnostic", 49 : &dc->diagnostic), 50 0 : GNUNET_PQ_result_spec_bool ("suppressed", 51 : &dc->suppressed), 52 : GNUNET_PQ_result_spec_end 53 : }; 54 : 55 0 : PREPARE (pg, 56 : "auditor_lookup_reserve_in_inconsistency", 57 : "SELECT" 58 : " row_id" 59 : ",amount_exchange_expected" 60 : ",amount_wired" 61 : ",reserve_pub" 62 : ",timestamp" 63 : ",account" 64 : ",diagnostic" 65 : ",suppressed" 66 : " FROM auditor_reserve_in_inconsistency" 67 : " WHERE (bank_row_id = $1)" 68 : ); 69 0 : dc->bank_row_id = bank_row_id; 70 0 : return GNUNET_PQ_eval_prepared_singleton_select ( 71 : pg->conn, 72 : "auditor_lookup_reserve_in_inconsistency", 73 : params, 74 : rs); 75 : }