Line data Source code
1 : /*
2 : This file is part of TALER
3 : Copyright (C) 2022 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/insert_drain_profit.c
18 : * @brief Implementation of the insert_drain_profit function for Postgres
19 : * @author Christian Grothoff
20 : */
21 : #include "taler/taler_pq_lib.h"
22 : #include "exchange-database/insert_drain_profit.h"
23 : #include "helper.h"
24 :
25 :
26 : enum GNUNET_DB_QueryStatus
27 0 : TALER_EXCHANGEDB_insert_drain_profit (
28 : struct TALER_EXCHANGEDB_PostgresContext *pg,
29 : const struct TALER_WireTransferIdentifierRawP *wtid,
30 : const char *account_section,
31 : const struct TALER_FullPayto payto_uri,
32 : struct GNUNET_TIME_Timestamp request_timestamp,
33 : const struct TALER_Amount *amount,
34 : const struct TALER_MasterSignatureP *master_sig)
35 : {
36 0 : struct GNUNET_PQ_QueryParam params[] = {
37 0 : GNUNET_PQ_query_param_auto_from_type (wtid),
38 0 : GNUNET_PQ_query_param_string (account_section),
39 0 : GNUNET_PQ_query_param_string (payto_uri.full_payto),
40 0 : GNUNET_PQ_query_param_timestamp (&request_timestamp),
41 0 : TALER_PQ_query_param_amount (pg->conn,
42 : amount),
43 0 : GNUNET_PQ_query_param_auto_from_type (master_sig),
44 : GNUNET_PQ_query_param_end
45 : };
46 :
47 0 : PREPARE (pg,
48 : "drain_profit_insert",
49 : "INSERT INTO profit_drains "
50 : "(wtid"
51 : ",account_section"
52 : ",payto_uri"
53 : ",trigger_date"
54 : ",amount"
55 : ",master_sig"
56 : ") VALUES ($1, $2, $3, $4, $5, $6);");
57 0 : return GNUNET_PQ_eval_prepared_non_select (pg->conn,
58 : "drain_profit_insert",
59 : params);
60 : }
|