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 exchangedb/pg_wad_in_insert.c 18 : * @brief Implementation of the wad_in_insert 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_wad_in_insert.h" 26 : #include "pg_helper.h" 27 : 28 : enum GNUNET_DB_QueryStatus 29 0 : TEH_PG_wad_in_insert ( 30 : void *cls, 31 : const struct TALER_WadIdentifierP *wad_id, 32 : const char *origin_exchange_url, 33 : const struct TALER_Amount *amount, 34 : struct GNUNET_TIME_Timestamp execution_date, 35 : const struct TALER_FullPayto debit_account_uri, 36 : const char *section_name, 37 : uint64_t serial_id) 38 : { 39 0 : struct PostgresClosure *pg = cls; 40 0 : struct GNUNET_PQ_QueryParam params[] = { 41 0 : GNUNET_PQ_query_param_auto_from_type (wad_id), 42 0 : GNUNET_PQ_query_param_string (origin_exchange_url), 43 0 : TALER_PQ_query_param_amount (pg->conn, 44 : amount), 45 0 : GNUNET_PQ_query_param_timestamp (&execution_date), 46 : GNUNET_PQ_query_param_end 47 : }; 48 : 49 : // FIXME-#7271: should we keep the account data + serial_id? 50 0 : PREPARE (pg, 51 : "wad_in_insert", 52 : "INSERT INTO wads_in " 53 : "(wad_id" 54 : ",origin_exchange_url" 55 : ",amount" 56 : ",arrival_time" 57 : ") VALUES " 58 : "($1, $2, $3, $4);"); 59 0 : return GNUNET_PQ_eval_prepared_non_select (pg->conn, 60 : "wad_in_insert", 61 : params); 62 : }