summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpriscilla <priscilla.huang@efrei.net>2022-11-17 07:36:00 -0500
committerpriscilla <priscilla.huang@efrei.net>2022-11-17 07:36:00 -0500
commit6efc5477e7bebfc1d251d06b57baf08080d8ff93 (patch)
tree456ed7535fcda7ee15bbab0408c0a09dc05dc1ff
parent111b27321d504d83f523ecbe0880f69d96a6ea82 (diff)
downloadmerchant-6efc5477e7bebfc1d251d06b57baf08080d8ff93.tar.gz
merchant-6efc5477e7bebfc1d251d06b57baf08080d8ff93.tar.bz2
merchant-6efc5477e7bebfc1d251d06b57baf08080d8ff93.zip
update
-rw-r--r--src/backenddb/merchant-0004.sql2
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c20
-rw-r--r--src/backenddb/test_merchantdb.c5
3 files changed, 17 insertions, 10 deletions
diff --git a/src/backenddb/merchant-0004.sql b/src/backenddb/merchant-0004.sql
index 204f14ca..62862937 100644
--- a/src/backenddb/merchant-0004.sql
+++ b/src/backenddb/merchant-0004.sql
@@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS merchant_template
,template_contract VARCHAR NOT NULL -- in JSON format
,UNIQUE (merchant_serial, template_id)
);
-COMMENT ON TABLE merchant_template
+COMMENT ON TABLE merchant_template
IS 'template used by the merchant (may be incomplete, frontend can override)';
COMMENT ON COLUMN merchant_template.template_description
IS 'Human-readable template description';
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 11ee8db6..fe4a045f 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -6864,7 +6864,7 @@ postgres_insert_template (void *cls,
GNUNET_PQ_query_param_string (template_id),
GNUNET_PQ_query_param_string (pd->template_description),
GNUNET_PQ_query_param_string (pd->image),
- GNUNET_PQ_query_param_json_t (pd->template_contract),
+ TALER_PQ_query_param_json (pd->template_contract),
GNUNET_PQ_query_param_end
};
@@ -6898,7 +6898,7 @@ postgres_update_template (void *cls,
GNUNET_PQ_query_param_string (template_id),
GNUNET_PQ_query_param_string (pd->template_description),
GNUNET_PQ_query_param_string (pd->image),
- GNUNET_PQ_query_param_json_t (pd->template_contract),
+ TALER_PQ_query_param_json (pd->template_contract),
GNUNET_PQ_query_param_end
};
@@ -6923,7 +6923,7 @@ struct LookupTemplateContext
/**
* Function to call with the results.
*/
- TALER_MERCHANTDB_TemplateCallback cb;
+ TALER_MERCHANTDB_TemplatesCallback cb;
/**
* Closure for @a cb.
@@ -6955,6 +6955,7 @@ lookup_templates_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++)
{
char *template_id;
+ char *template_description;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("template_id",
&template_id),
@@ -6973,7 +6974,8 @@ lookup_templates_cb (void *cls,
return;
}
tlc->cb (tlc->cb_cls,
- template_id);
+ template_id,
+ template_description);
GNUNET_PQ_cleanup_result (rs);
}
}
@@ -6991,7 +6993,7 @@ lookup_templates_cb (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_lookup_templates (void *cls,
const char *instance_id,
- TALER_MERCHANTDB_TemplateCallback cb,
+ TALER_MERCHANTDB_TemplatesCallback cb,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
@@ -7061,7 +7063,7 @@ postgres_lookup_template (void *cls,
&pd->template_description),
GNUNET_PQ_result_spec_string ("image",
&pd->image),
- GNUNET_PQ_result_spec_json_t ("template_contract",
+ TALER_PQ_result_spec_json ("template_contract",
&pd->template_contract),
GNUNET_PQ_result_spec_end
};
@@ -9551,7 +9553,7 @@ postgres_connect (void *cls)
" (SELECT merchant_serial "
" FROM merchant_instances"
" WHERE merchant_id=$1)"
- " AND merchant_template.template_id=$2"
+ " AND merchant_template.template_id=$2"),
/* for postgres_insert_template() */
GNUNET_PQ_make_prepare ("insert_template",
"INSERT INTO merchant_template"
@@ -9575,7 +9577,7 @@ postgres_connect (void *cls)
" (SELECT merchant_serial"
" FROM merchant_instances"
" WHERE merchant_id=$1)"
- " AND template_id=$2"
+ " AND template_id=$2"),
GNUNET_PQ_PREPARED_STATEMENT_END
};
struct GNUNET_PQ_ExecuteStatement es[] = {
@@ -9591,7 +9593,7 @@ postgres_connect (void *cls)
if (NULL == pg->conn)
return GNUNET_SYSERR;
return GNUNET_OK;
-}
+ };
/**
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 19005d41..d1510aa8 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -6890,6 +6890,8 @@ run (void *cls)
result = run_tests ();
if (0 == result)
+ /* result = run_template_tests ();
+ if (0 == result)*/
{
/* Test dropping tables */
if (GNUNET_OK != plugin->drop_tables (plugin->cls))
@@ -6952,4 +6954,7 @@ main (int argc,
}
+
+
+
/* end of test_merchantdb.c */