summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-27 16:35:04 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-27 16:35:04 -0400
commitc7465ea592f0cd34d259e3f94227e3320f62208a (patch)
tree0ce7400df5f18b33de69b5474d7b94224106df7c /src/backenddb/plugin_merchantdb_postgres.c
parent4b820e27ad2fdfda79e256c0b0624ad01150c5b3 (diff)
downloadmerchant-c7465ea592f0cd34d259e3f94227e3320f62208a.tar.gz
merchant-c7465ea592f0cd34d259e3f94227e3320f62208a.tar.bz2
merchant-c7465ea592f0cd34d259e3f94227e3320f62208a.zip
removed hardcoded row numbers from backenddb tests
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index efb58918..54d99d66 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1449,20 +1449,36 @@ postgres_lookup_contract_terms (void *cls,
GNUNET_PQ_query_param_string (order_id),
GNUNET_PQ_query_param_end
};
- 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
- };
-
- *contract_terms = NULL;
check_connection (pg);
- return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_contract_terms",
- params,
- rs);
+ 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
+ };
+
+ *contract_terms = NULL;
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "lookup_contract_terms",
+ params,
+ rs);
+ }
}