summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-12-29 14:47:17 +0100
committerChristian Grothoff <christian@grothoff.org>2022-12-29 14:47:17 +0100
commit2c19f6a6fb180f059fcaeb193dd387c4d6af21b1 (patch)
treed7fdd874e84950510f5a7a698007023ed46d80ea /src/backenddb
parent689bbc7a201067815cb0975703422854099d19ba (diff)
downloadmerchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.tar.gz
merchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.tar.bz2
merchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.zip
-towards fixing the template tests
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 32f0b1be..e3f5762d 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -6864,10 +6864,11 @@ postgres_insert_template (void *cls,
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_string (template_id),
GNUNET_PQ_query_param_string (td->template_description),
- GNUNET_PQ_query_param_string (td->image),
+ NULL == td->image
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_string (td->image),
TALER_PQ_query_param_json (td->template_contract),
GNUNET_PQ_query_param_end
-
};
check_connection (pg);
@@ -7059,14 +7060,17 @@ postgres_lookup_template (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("template_description",
&td->template_description),
- GNUNET_PQ_result_spec_string ("image",
- &td->image),
+ GNUNET_PQ_result_spec_allow_null (
+ GNUNET_PQ_result_spec_string ("image",
+ &td->image),
+ NULL),
TALER_PQ_result_spec_json ("template_contract",
&td->template_contract),
GNUNET_PQ_result_spec_end
};
check_connection (pg);
+ td->image = NULL;
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"lookup_template",
params,
@@ -7074,7 +7078,8 @@ postgres_lookup_template (void *cls,
}
}
- /**
+
+/**
* Delete information about a webhook.
*
* @param cls closure
@@ -7085,8 +7090,8 @@ postgres_lookup_template (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_delete_webhook (void *cls,
- const char *instance_id,
- const char *webhook_id)
+ const char *instance_id,
+ const char *webhook_id)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -7113,9 +7118,9 @@ postgres_delete_webhook (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_insert_webhook (void *cls,
- const char *instance_id,
- const char *webhook_id,
- const struct TALER_MERCHANTDB_WebhookDetails *wb)
+ const char *instance_id,
+ const char *webhook_id,
+ const struct TALER_MERCHANTDB_WebhookDetails *wb)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -7150,9 +7155,9 @@ postgres_insert_webhook (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_update_webhook (void *cls,
- const char *instance_id,
- const char *webhook_id,
- const struct TALER_MERCHANTDB_WebhookDetails *wb)
+ const char *instance_id,
+ const char *webhook_id,
+ const struct TALER_MERCHANTDB_WebhookDetails *wb)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -7206,8 +7211,8 @@ struct LookupWebhookContext
*/
static void
lookup_webhooks_cb (void *cls,
- PGresult *result,
- unsigned int num_results)
+ PGresult *result,
+ unsigned int num_results)
{
struct LookupWebhookContext *wlc = cls;
@@ -7239,6 +7244,7 @@ lookup_webhooks_cb (void *cls,
}
}
+
/**
* Lookup all of the webhooks the given instance has configured.
*
@@ -7250,9 +7256,9 @@ lookup_webhooks_cb (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_lookup_webhooks (void *cls,
- const char *instance_id,
- TALER_MERCHANTDB_WebhooksCallback cb,
- void *cb_cls)
+ const char *instance_id,
+ TALER_MERCHANTDB_WebhooksCallback cb,
+ void *cb_cls)
{
struct PostgresClosure *pg = cls;
struct LookupWebhookContext wlc = {
@@ -7292,9 +7298,9 @@ postgres_lookup_webhooks (void *cls,
*/
static enum GNUNET_DB_QueryStatus
postgres_lookup_webhook (void *cls,
- const char *instance_id,
- const char *webhook_id,
- struct TALER_MERCHANTDB_WebhookDetails *wb)
+ const char *instance_id,
+ const char *webhook_id,
+ struct TALER_MERCHANTDB_WebhookDetails *wb)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {