gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 262/277: deduplicate logic


From: gnunet
Subject: [taler-merchant] 262/277: deduplicate logic
Date: Sun, 05 Jul 2020 20:52:55 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit a118bd2c4951fa7b60737e3cca69e62266a1bcef
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jun 28 11:04:48 2020 +0200

    deduplicate logic
---
 src/backenddb/plugin_merchantdb_postgres.c | 44 ++++++++++--------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 54d99d6..ae56602 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1449,36 +1449,22 @@ postgres_lookup_contract_terms (void *cls,
     GNUNET_PQ_query_param_string (order_id),
     GNUNET_PQ_query_param_end
   };
-  check_connection (pg);
-  if (NULL == contract_terms)
-  {
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_uint64 ("order_serial",
-                                    order_serial),
-      GNUNET_PQ_result_spec_end
-    };
-
-    return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                     "lookup_contract_terms",
-                                                     params,
-                                                     rs);
-  }
-  else
-  {
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      TALER_PQ_result_spec_json ("contract_terms",
-                                 contract_terms),
-      GNUNET_PQ_result_spec_uint64 ("order_serial",
-                                    order_serial),
-      GNUNET_PQ_result_spec_end
-    };
+  struct GNUNET_PQ_ResultSpec rs[] = {
+    /* contract_terms must be first! */
+    TALER_PQ_result_spec_json ("contract_terms",
+                               contract_terms),
+    GNUNET_PQ_result_spec_uint64 ("order_serial",
+                                  order_serial),
+    GNUNET_PQ_result_spec_end
+  };
 
-    *contract_terms = NULL;
-    return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                     "lookup_contract_terms",
-                                                     params,
-                                                     rs);
-  }
+  check_connection (pg);
+  return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                   "lookup_contract_terms",
+                                                   params,
+                                                   (NULL != contract_terms)
+                                                   ? rs
+                                                   : &rs[1]);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]