pg_wad_in_insert.c (2118B)
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 "taler/taler_pq_lib.h" 22 #include "taler/exchange-database/wad_in_insert.h" 23 #include "helper.h" 24 25 enum GNUNET_DB_QueryStatus 26 TALER_EXCHANGEDB_wad_in_insert ( 27 struct TALER_EXCHANGEDB_PostgresContext *pg, 28 const struct TALER_WadIdentifierP *wad_id, 29 const char *origin_exchange_url, 30 const struct TALER_Amount *amount, 31 struct GNUNET_TIME_Timestamp execution_date, 32 const struct TALER_FullPayto debit_account_uri, 33 const char *section_name, 34 uint64_t serial_id) 35 { 36 struct GNUNET_PQ_QueryParam params[] = { 37 GNUNET_PQ_query_param_auto_from_type (wad_id), 38 GNUNET_PQ_query_param_string (origin_exchange_url), 39 TALER_PQ_query_param_amount (pg->conn, 40 amount), 41 GNUNET_PQ_query_param_timestamp (&execution_date), 42 GNUNET_PQ_query_param_end 43 }; 44 45 // FIXME-#7271: should we keep the account data + serial_id? 46 PREPARE (pg, 47 "wad_in_insert", 48 "INSERT INTO wads_in " 49 "(wad_id" 50 ",origin_exchange_url" 51 ",amount" 52 ",arrival_time" 53 ") VALUES " 54 "($1, $2, $3, $4);"); 55 return GNUNET_PQ_eval_prepared_non_select (pg->conn, 56 "wad_in_insert", 57 params); 58 }