gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: -misc fixes


From: gnunet
Subject: [taler-donau] branch master updated: -misc fixes
Date: Wed, 17 Apr 2024 11:57:50 +0200

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

grothoff pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 354c630  -misc fixes
354c630 is described below

commit 354c630648c5f86310718eaaabe224595bd4cb38
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 17 11:57:45 2024 +0200

    -misc fixes
---
 src/donau/donau-httpd_batch-submit.c | 19 +++++++++----------
 src/donaudb/donau-0001.sql           |  5 ++---
 src/donaudb/pg_create_tables.c       | 16 +++++++++++++++-
 src/donaudb/test_donaudb.c           |  2 ++
 src/util/donau_os_installation.c     |  2 ++
 5 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/donau/donau-httpd_batch-submit.c 
b/src/donau/donau-httpd_batch-submit.c
index b038fa7..5a5f6c5 100644
--- a/src/donau/donau-httpd_batch-submit.c
+++ b/src/donau/donau-httpd_batch-submit.c
@@ -163,7 +163,15 @@ DH_handler_submit_receipts_post (struct DH_RequestContext 
*rc,
   const size_t num_dr = json_array_size (donation_receipts);
   struct DONAU_DonationReceipt *dr_arr;
 
-  if (0 != num_dr)
+  if (0 == num_dr)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Empty array of donation receipts!\n");
+    return TALER_MHD_reply_with_error (rc->connection,
+                                       MHD_HTTP_BAD_REQUEST,
+                                       TALER_EC_GENERIC_PARAMETER_MALFORMED,
+                                       "donation_receipts");
+  }
   {
     json_t *dr_obj;
     size_t index;
@@ -184,15 +192,6 @@ DH_handler_submit_receipts_post (struct DH_RequestContext 
*rc,
       }
     }
   }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Empty array of donation receipts!\n");
-    return TALER_MHD_reply_with_error (rc->connection,
-                                       MHD_HTTP_BAD_REQUEST,
-                                       TALER_EC_GENERIC_PARAMETER_MALFORMED,
-                                       "donation_receipts");
-  }
 
   for (size_t i = 0; i < num_dr; i++)
   {
diff --git a/src/donaudb/donau-0001.sql b/src/donaudb/donau-0001.sql
index 30597ae..dd6d348 100644
--- a/src/donaudb/donau-0001.sql
+++ b/src/donaudb/donau-0001.sql
@@ -49,8 +49,7 @@ COMMENT ON COLUMN donau_tables.finished
 --                   Main DB setup loop
 ---------------------------------------------------------------------------
 
-CREATE FUNCTION do_create_tables()
-  RETURNS VOID
+CREATE PROCEDURE do_create_tables()
   LANGUAGE plpgsql
 AS $$
 DECLARE
@@ -106,7 +105,7 @@ BEGIN
   END LOOP; -- create/alter/drop actions
 END $$;
 
-COMMENT ON FUNCTION do_create_tables
+COMMENT ON PROCEDURE do_create_tables
   IS 'Creates all tables for the given number of partitions that need 
creating. Does NOT support sharding.';
 
 
diff --git a/src/donaudb/pg_create_tables.c b/src/donaudb/pg_create_tables.c
index 5d42757..6991694 100644
--- a/src/donaudb/pg_create_tables.c
+++ b/src/donaudb/pg_create_tables.c
@@ -39,7 +39,7 @@ DH_PG_create_tables (void *cls)
 
   struct GNUNET_PQ_PreparedStatement ps[] = {
     GNUNET_PQ_make_prepare ("create_tables",
-                            "SELECT"
+                            "CALL"
                             " donau.do_create_tables"
                             " ();"),
     GNUNET_PQ_PREPARED_STATEMENT_END
@@ -56,15 +56,29 @@ DH_PG_create_tables (void *cls)
                                      es,
                                      ps);
   if (NULL == conn)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to connect to database\n");
     return GNUNET_SYSERR;
+  }
   if (0 >
       GNUNET_PQ_eval_prepared_non_select (conn,
                                           "create_tables",
                                           params))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to create tables\n");
     ret = GNUNET_SYSERR;
+  }
   if (GNUNET_OK == ret)
+  {
     ret = GNUNET_PQ_exec_sql (conn,
                               "procedures");
+    if (GNUNET_OK != ret)
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Failed to load stored procedures: %d\n",
+                  ret);
+  }
   GNUNET_PQ_disconnect (conn);
   return ret;
 }
diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c
index 16a3122..9cf33c0 100644
--- a/src/donaudb/test_donaudb.c
+++ b/src/donaudb/test_donaudb.c
@@ -100,6 +100,8 @@ run (void *cls)
   if (NULL ==
       (plugin = DONAUDB_plugin_load (cfg)))
   {
+    fprintf (stderr,
+             "Failed to load DB plugin\n");
     result = 77;
     return;
   }
diff --git a/src/util/donau_os_installation.c b/src/util/donau_os_installation.c
index 0bbdd19..0e1959b 100644
--- a/src/util/donau_os_installation.c
+++ b/src/util/donau_os_installation.c
@@ -24,6 +24,7 @@
  * @author Lukas Matyja
  */
 #include <taler/platform.h>
+#include <taler/taler_util.h>
 #include <gnunet/gnunet_util_lib.h>
 
 
@@ -64,6 +65,7 @@ DONAU_project_data_default (void)
 void __attribute__ ((constructor))
 DONAU_OS_init ()
 {
+  GNUNET_OS_init (TALER_project_data_default ());
   GNUNET_OS_init (&donau_pd);
 }
 

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