aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-02 11:40:44 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-02 11:40:44 +0100
commit915542e69c5a481b8885661171880446d4ef009d (patch)
treecf05a85359ee9074ec81ba5791c399ee3749853d /src/exchangedb
parentf8ff9c996f2fbdde9110b473bee39ea173d2b40f (diff)
first draft of implementation of GET AML decisions endpoint
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/pg_select_aml_process.c8
-rw-r--r--src/exchangedb/pg_select_aml_process.h2
2 files changed, 8 insertions, 2 deletions
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);