[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix #6782
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix #6782 |
Date: |
Thu, 04 Mar 2021 11:19:06 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 39232092 fix #6782
39232092 is described below
commit 39232092eb3038d720d81e6b7891f6bdd7c048f0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Mar 4 11:19:04 2021 +0100
fix #6782
---
src/backenddb/plugin_merchantdb_postgres.c | 133 +++++++++++++++++++----------
1 file changed, 86 insertions(+), 47 deletions(-)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index f4394a7e..e39d8498 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -4301,37 +4301,6 @@ postgres_lookup_transfers (void *cls,
{
struct PostgresClosure *pg = cls;
uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit);
- struct GNUNET_PQ_QueryParam params_payto_et[] = {
- GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_absolute_time (&before),
- GNUNET_PQ_query_param_absolute_time (&after),
- GNUNET_PQ_query_param_uint64 (&offset),
- GNUNET_PQ_query_param_uint64 (&plimit),
- GNUNET_PQ_query_param_string (payto_uri),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_QueryParam params_et[] = {
- GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_absolute_time (&before),
- GNUNET_PQ_query_param_absolute_time (&after),
- GNUNET_PQ_query_param_uint64 (&offset),
- GNUNET_PQ_query_param_uint64 (&plimit),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_QueryParam params_payto[] = {
- GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_uint64 (&offset),
- GNUNET_PQ_query_param_uint64 (&plimit),
- GNUNET_PQ_query_param_string (payto_uri),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_QueryParam params_none[] = {
- GNUNET_PQ_query_param_string (instance_id),
- GNUNET_PQ_query_param_uint64 (&offset),
- GNUNET_PQ_query_param_uint64 (&plimit),
- GNUNET_PQ_query_param_end
- };
- struct GNUNET_PQ_QueryParam *params;
struct LookupTransfersContext ltc = {
.cb = cb,
.cb_cls = cb_cls,
@@ -4339,27 +4308,97 @@ postgres_lookup_transfers (void *cls,
.verified = verified
};
enum GNUNET_DB_QueryStatus qs;
- char stmt[128];
bool by_time;
by_time = ( (before.abs_value_us !=
GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) ||
- (after.abs_value_us != GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us)
);
+ (after.abs_value_us !=
+ GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us) );
check_connection (pg);
- GNUNET_snprintf (stmt,
- sizeof (stmt),
- "lookup_transfers%s%s%s",
- (by_time) ? "_time" : "",
- (NULL != payto_uri) ? "_payto" : "",
- (limit > 0) ? "_asc" : "_desc");
- params = (by_time)
- ? ( (NULL != payto_uri) ? params_payto_et : params_et)
- : ( (NULL != payto_uri) ? params_payto : params_none);
- qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
- stmt,
- params,
- &lookup_transfers_cb,
- <c);
+ if (by_time)
+ {
+ if (NULL != payto_uri)
+ {
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (instance_id),
+ GNUNET_PQ_query_param_absolute_time (&before),
+ GNUNET_PQ_query_param_absolute_time (&after),
+ GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&plimit),
+ GNUNET_PQ_query_param_string (payto_uri),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_multi_select (
+ pg->conn,
+ (limit > 0)
+ ? "lookup_transfers_time_payto_asc"
+ : "lookup_transfers_time_payto_desc",
+ params,
+ &lookup_transfers_cb,
+ <c);
+ }
+ else
+ {
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (instance_id),
+ GNUNET_PQ_query_param_absolute_time (&before),
+ GNUNET_PQ_query_param_absolute_time (&after),
+ GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&plimit),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_multi_select (
+ pg->conn,
+ (limit > 0)
+ ? "lookup_transfers_time_asc"
+ : "lookup_transfers_time_desc",
+ params,
+ &lookup_transfers_cb,
+ <c);
+ }
+ }
+ else
+ {
+ if (NULL != payto_uri)
+ {
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (instance_id),
+ GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&plimit),
+ GNUNET_PQ_query_param_string (payto_uri),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_multi_select (
+ pg->conn,
+ (limit > 0)
+ ? "lookup_transfers_payto_asc"
+ : "lookup_transfers_payto_desc",
+ params,
+ &lookup_transfers_cb,
+ <c);
+ }
+ else
+ {
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (instance_id),
+ GNUNET_PQ_query_param_uint64 (&offset),
+ GNUNET_PQ_query_param_uint64 (&plimit),
+ GNUNET_PQ_query_param_end
+ };
+
+ qs = GNUNET_PQ_eval_prepared_multi_select (
+ pg->conn,
+ (limit > 0)
+ ? "lookup_transfers_asc"
+ : "lookup_transfers_desc",
+ params,
+ &lookup_transfers_cb,
+ <c);
+ }
+ }
if (0 >= qs)
return qs;
return ltc.qs;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix #6782,
gnunet <=