gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 02/02: fix database timestamp handling


From: gnunet
Subject: [taler-anastasis] 02/02: fix database timestamp handling
Date: Wed, 14 Jul 2021 11:06:01 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

commit d0aaf88534d29bb054befa3e767b9f0e9abb3686
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jul 14 11:05:56 2021 +0200

    fix database timestamp handling
---
 src/stasis/plugin_anastasis_postgres.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index d18456a..7c82e2c 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -548,8 +548,8 @@ postgres_increment_lifetime (
       };
       struct GNUNET_TIME_Absolute expiration;
       struct GNUNET_PQ_ResultSpec rs[] = {
-        GNUNET_PQ_result_spec_auto_from_type ("expiration_date",
-                                              &expiration),
+        GNUNET_PQ_result_spec_absolute_time ("expiration_date",
+                                             &expiration),
         GNUNET_PQ_result_spec_end
       };
 
@@ -673,8 +673,8 @@ postgres_record_recdoc_payment (
       GNUNET_PQ_query_param_end
     };
     struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_auto_from_type ("expiration_date",
-                                            &expiration),
+      GNUNET_PQ_result_spec_absolute_time ("expiration_date",
+                                           &expiration),
       GNUNET_PQ_result_spec_end
     };
 
@@ -876,22 +876,26 @@ postgres_check_challenge_payment (
   bool *paid)
 {
   struct PostgresClosure *pg = cls;
+  uint8_t paid8;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (payment_secret),
     GNUNET_PQ_query_param_auto_from_type (truth_uuid),
     GNUNET_PQ_query_param_end
   };
+  enum GNUNET_DB_QueryStatus qs;
   struct GNUNET_PQ_ResultSpec rs[] = {
     GNUNET_PQ_result_spec_auto_from_type ("paid",
-                                          paid),
+                                          &paid8),
     GNUNET_PQ_result_spec_end
   };
 
   check_connection (pg);
-  return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                   "challenge_payment_select",
-                                                   params,
-                                                   rs);
+  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                 "challenge_payment_select",
+                                                 params,
+                                                 rs);
+  *paid = (0 != paid8);
+  return qs;
 }
 
 
@@ -914,13 +918,14 @@ postgres_check_payment_identifier (
 {
   struct PostgresClosure *pg = cls;
   uint32_t counter;
+  uint8_t paid8;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (payment_secret),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
     GNUNET_PQ_result_spec_auto_from_type ("paid",
-                                          paid),
+                                          &paid8),
     GNUNET_PQ_result_spec_uint32 ("post_counter",
                                   &counter),
     GNUNET_PQ_result_spec_end
@@ -939,6 +944,7 @@ postgres_check_payment_identifier (
       *valid_counter = true;
     else
       *valid_counter = false;
+    *paid = (0 != paid8);
   }
   return qs;
 }
@@ -1100,8 +1106,8 @@ postgres_lookup_account (
   postgres_preflight (pg);
   {
     struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_auto_from_type ("expiration_date",
-                                            &paid_until),
+      GNUNET_PQ_result_spec_absolute_time ("expiration_date",
+                                           paid_until),
       GNUNET_PQ_result_spec_auto_from_type ("recovery_data_hash",
                                             recovery_data_hash),
       GNUNET_PQ_result_spec_uint32 ("version",
@@ -1130,8 +1136,8 @@ postgres_lookup_account (
   /* check if account exists */
   {
     struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_auto_from_type ("expiration_date",
-                                            &paid_until),
+      GNUNET_PQ_result_spec_absolute_time ("expiration_date",
+                                           paid_until),
       GNUNET_PQ_result_spec_end
     };
 

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