gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: -support Florian DB API


From: gnunet
Subject: [taler-merchant] branch master updated: -support Florian DB API
Date: Tue, 20 Jul 2021 20:26:57 +0200

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 6de96269 -support Florian DB API
6de96269 is described below

commit 6de96269d59c66dbede9177f4e65f8d2cc828f2d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jul 20 20:26:55 2021 +0200

    -support Florian DB API
---
 src/backenddb/plugin_merchantdb_postgres.c | 45 ++++++++++++++++++++++++++++++
 src/include/taler_merchantdb_plugin.h      | 13 +++++++++
 2 files changed, 58 insertions(+)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 570c681a..3446cee7 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -592,6 +592,40 @@ postgres_lookup_instances (void *cls,
 }
 
 
+/**
+ * Lookup authentication data of an instance.
+ *
+ * @param cls closure
+ * @param instance_id instance to query
+ * @param[out] ias where to store the auth data
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_lookup_instance_auth (
+  void *cls,
+  const char *instance_id,
+  struct TALER_MERCHANTDB_InstanceAuthSettings *ias)
+{
+  struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_string (instance_id),
+    GNUNET_PQ_query_param_end
+  };
+  struct GNUNET_PQ_ResultSpec rs[] = {
+    GNUNET_PQ_result_spec_auto_from_type ("auth_hash",
+                                          &ias->auth_hash),
+    GNUNET_PQ_result_spec_auto_from_type ("auth_salt",
+                                          &ias->auth_salt),
+    GNUNET_PQ_result_spec_end
+  };
+
+  check_connection (pg);
+  return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                   "lookup_instance_auth",
+                                                   params,
+                                                   rs);
+}
+
+
 /**
  * Insert information about an instance into our database.
  *
@@ -6288,6 +6322,16 @@ postgres_connect (void *cls)
                             " WHERE merchant_serial=$1",
                             1),
     /* for postgres_lookup_instances() */
+    GNUNET_PQ_make_prepare ("lookup_instance_auth",
+                            "SELECT"
+                            " auth_hash"
+                            ",auth_salt"
+                            " FROM merchant_instances"
+                            /* only use 'active' instances */
+                            " JOIN merchant_keys USING (merchant_id)"
+                            " WHERE merchant_id=$1",
+                            1),
+    /* for postgres_lookup_instances() */
     GNUNET_PQ_make_prepare ("lookup_instances",
                             "SELECT"
                             " merchant_serial"
@@ -8750,6 +8794,7 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
   plugin->rollback = &postgres_rollback;
   plugin->commit = &postgres_commit;
   plugin->lookup_instances = &postgres_lookup_instances;
+  plugin->lookup_instance_auth = &postgres_lookup_instance_auth;
   plugin->insert_instance = &postgres_insert_instance;
   plugin->insert_account = &postgres_insert_account;
   plugin->delete_instance_private_key = &postgres_delete_instance_private_key;
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index 0397b9aa..6756a681 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -782,6 +782,19 @@ struct TALER_MERCHANTDB_Plugin
                       TALER_MERCHANTDB_InstanceCallback cb,
                       void *cb_cls);
 
+  /**
+   * Lookup authentication data of an instance.
+   *
+   * @param cls closure
+   * @param instance_id instance to query
+   * @param[out] ias where to store the auth data
+   */
+  enum GNUNET_DB_QueryStatus
+  (*lookup_instance_auth)(void *cls,
+                          const char *instance_id,
+                          struct TALER_MERCHANTDB_InstanceAuthSettings *ias);
+
+
   /**
    * Insert information about an instance into our database.
    *

-- 
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]