gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: added charity pg lookup


From: gnunet
Subject: [taler-donau] branch master updated: added charity pg lookup
Date: Fri, 05 Jan 2024 18:19:31 +0100

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new ef4a622  added charity pg lookup
ef4a622 is described below

commit ef4a622a6aa5d3064f89be37b56d1dc48eb2bd40
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Fri Jan 5 18:18:48 2024 +0100

    added charity pg lookup
---
 src/donau/donau-httpd_get-charity.c | 14 ++++-----
 src/donaudb/pg_lookup_charity.c     | 57 +++++++++++++++++++++++++++++++++++++
 src/donaudb/pg_lookup_charity.h     | 40 ++++++++++++++++++++++++++
 3 files changed, 104 insertions(+), 7 deletions(-)

diff --git a/src/donau/donau-httpd_get-charity.c 
b/src/donau/donau-httpd_get-charity.c
index 86daab4..87f6d38 100644
--- a/src/donau/donau-httpd_get-charity.c
+++ b/src/donau/donau-httpd_get-charity.c
@@ -100,17 +100,17 @@ DH_handler_charity_get (
     }
 
     result = TALER_MHD_REPLY_JSON_PACK (
-    connection,
-    http_status,
-    TALER_MHD_PACK_EC (ec),
-    GNUNET_JSON_pack_string ("url",
+      connection,
+      http_status,
+      TALER_MHD_PACK_EC (ec),
+      GNUNET_JSON_pack_string ("url",
                                charity_url),
       GNUNET_JSON_pack_string ("name",
                                charity_name));
 
-    GNUNET_free(charity_url);
-    GNUNET_free(charity_name);
-    return result
+    GNUNET_free (charity_url);
+    GNUNET_free (charity_name);
+    return result;
   }
 }
 
diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c
new file mode 100644
index 0000000..94f2258
--- /dev/null
+++ b/src/donaudb/pg_lookup_charity.c
@@ -0,0 +1,57 @@
+/*
+   This file is part of TALER
+   Copyright (C) 2024 Taler Systems SA
+
+   TALER is free software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the Free Software
+   Foundation; either version 3, or (at your option) any later version.
+
+   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along with
+   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file donaudb/pg_lookup_donation_unit_key.c
+ * @brief Implementation of the lookup_donation_unit_key function for Postgres
+ * @author Johannes Casaburi
+ */
+#include "taler/platform.h"
+#include "taler/taler_error_codes.h"
+#include "taler/taler_dbevents.h"
+#include "taler/taler_pq_lib.h"
+#include "pg_lookup_charity.h"
+#include "pg_helper.h"
+
+enum GNUNET_DB_QueryStatus
+DH_PG_lookup_charity (
+  void *cls,
+  struct DONAUDB_CharityMetaData *meta)
+{
+  struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_uint64 (charity_id),
+    GNUNET_PQ_query_param_end
+  };
+  struct GNUNET_PQ_ResultSpec rs[] = {
+    GNUNET_PQ_query_param_string ("charity_url",
+                                          &meta->charity_url),
+    GNUNET_PQ_query_param_string ("charity_name",
+                                  &meta->charity_name),
+    GNUNET_PQ_result_spec_end
+  };
+
+  PREPARE (pg,
+           "lookup_charity",
+           "SELECT "
+           " charity_name"
+           " ,charity_url"
+           " FROM charities"
+           " WHERE charity_id=$1;");
+  return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                   "lookup_charity",
+                                                   params,
+                                                   rs);
+}
diff --git a/src/donaudb/pg_lookup_charity.h b/src/donaudb/pg_lookup_charity.h
new file mode 100644
index 0000000..7c10277
--- /dev/null
+++ b/src/donaudb/pg_lookup_charity.h
@@ -0,0 +1,40 @@
+/*
+   This file is part of TALER
+   Copyright (C) 2024 Taler Systems SA
+
+   TALER is free software; you can redistribute it and/or modify it under the
+   terms of the GNU General Public License as published by the Free Software
+   Foundation; either version 3, or (at your option) any later version.
+
+   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+   WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
+   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along with
+   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file donaudb/pg_lookup_charity.h
+ * @brief implementation of the lookup_charity function for Postgres
+ * @author Johannes Casaburi
+ */
+#ifndef PG_GET_DONATION_UNIT_INFO_H
+#define PG_GET_DONATION_UNIT_INFO_H
+
+#include <taler/taler_util.h>
+#include "taler/taler_json_lib.h"
+#include "donaudb_plugin.h"
+/**
+ * Fetch information about a donation unit key.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param donation_unit_pub_hash hash of the public key
+ * @param[out] info information with value and other info about the coin
+ * @return transaction status code
+ */
+enum GNUNET_DB_QueryStatus
+DH_PG_lookup_charity (
+  void *cls,
+  struct DONAUDB_CharityMetaData *meta);
+
+#endif

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