summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_trigger_aml_process.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-12-30 21:28:19 +0100
committerChristian Grothoff <christian@grothoff.org>2022-12-30 21:28:19 +0100
commitb1d9745545ff528729b53312947ba768c336a1d8 (patch)
tree114bc999f01ac638dc0110167babda305d2fd7cb /src/exchangedb/pg_trigger_aml_process.c
parent5754adc414eaca8dcc2de47b6fcc12e9d1979c12 (diff)
downloadexchange-b1d9745545ff528729b53312947ba768c336a1d8.tar.gz
exchange-b1d9745545ff528729b53312947ba768c336a1d8.tar.bz2
exchange-b1d9745545ff528729b53312947ba768c336a1d8.zip
-work on new DB queries
Diffstat (limited to 'src/exchangedb/pg_trigger_aml_process.c')
-rw-r--r--src/exchangedb/pg_trigger_aml_process.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/exchangedb/pg_trigger_aml_process.c b/src/exchangedb/pg_trigger_aml_process.c
index 29ac2de1a..4dfc8a508 100644
--- a/src/exchangedb/pg_trigger_aml_process.c
+++ b/src/exchangedb/pg_trigger_aml_process.c
@@ -32,6 +32,28 @@ TEH_PG_trigger_aml_process (
const struct TALER_PaytoHashP *h_payto,
const struct TALER_Amount *threshold_crossed)
{
- GNUNET_break (0); // FIXME: not implemeted!
- return GNUNET_DB_STATUS_HARD_ERROR;
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (h_payto),
+ TALER_PQ_query_param_amount (threshold_crossed),
+ GNUNET_PQ_query_param_end
+ };
+
+ PREPARE (pg,
+ "trigger_aml_process",
+ "INSERT INTO aml_status"
+ "(h_payto"
+ ",threshold_val"
+ ",threshold_frac"
+ ",status)"
+ "VALUES"
+ "($1, $2, $3, 1)" // 1: decision needed
+ "ON CONFLICT DO"
+ " UPDATE SET"
+ " threshold_val=$2"
+ " ,threshold_frac=$3"
+ " ,status=status | 1;"); // do not clear 'frozen' status
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "trigger_aml_process",
+ params);
}