From 915542e69c5a481b8885661171880446d4ef009d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 2 Feb 2023 11:40:44 +0100 Subject: first draft of implementation of GET AML decisions endpoint --- src/exchangedb/pg_select_aml_process.c | 8 ++++++-- src/exchangedb/pg_select_aml_process.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/pg_select_aml_process.c b/src/exchangedb/pg_select_aml_process.c index 2105308fc..c165e230b 100644 --- a/src/exchangedb/pg_select_aml_process.c +++ b/src/exchangedb/pg_select_aml_process.c @@ -112,6 +112,7 @@ TEH_PG_select_aml_process ( void *cls, enum TALER_AmlDecisionState decision, uint64_t row_off, + uint64_t limit, bool forward, TALER_EXCHANGEDB_AmlStatusCallback cb, void *cb_cls) @@ -120,6 +121,7 @@ TEH_PG_select_aml_process ( struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint32 (&decision), GNUNET_PQ_query_param_uint64 (&row_off), + GNUNET_PQ_query_param_uint64 (&limit), GNUNET_PQ_query_param_end }; struct AmlProcessResultContext ctx = { @@ -144,7 +146,8 @@ TEH_PG_select_aml_process ( " FROM aml_status" " WHERE aml_status_serial_id > $2" " AND $1 = status & $1" - " ORDER BY aml_status_serial_id INC"); + " ORDER BY aml_status_serial_id INC" + " LIMIT $3"); PREPARE (pg, "select_aml_process_dec", "SELECT" @@ -156,7 +159,8 @@ TEH_PG_select_aml_process ( " FROM aml_status" " WHERE aml_status_serial_id < $2" " AND $1 = status & $1" - " ORDER BY aml_status_serial_id DESC"); + " ORDER BY aml_status_serial_id DESC" + " LIMIT $3"); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, stmt, params, diff --git a/src/exchangedb/pg_select_aml_process.h b/src/exchangedb/pg_select_aml_process.h index 019f58b26..648cace2e 100644 --- a/src/exchangedb/pg_select_aml_process.h +++ b/src/exchangedb/pg_select_aml_process.h @@ -32,6 +32,7 @@ * @param cls closure * @param decision which decision states to filter by * @param row_off offset to start from + * @param limit how many rows to return at most * @param forward true to go forward in time, false to go backwards * @param cb callback to invoke on each match * @param cb_cls closure for @a cb @@ -42,6 +43,7 @@ TEH_PG_select_aml_process ( void *cls, enum TALER_AmlDecisionState decision, uint64_t row_off, + uint64_t limit, bool forward, TALER_EXCHANGEDB_AmlStatusCallback cb, void *cb_cls); -- cgit v1.2.3