commit 7aed59a60b535fbacdd6ba10da851b59f1a45927
parent cebd3d507e47fd10670b2f3514fc3ba40ad79f1a
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Wed, 1 Jul 2026 16:38:47 +0200
fix #11593
Diffstat:
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/backenddb/helper.h b/src/backenddb/helper.h
@@ -71,15 +71,16 @@ struct TALER_MERCHANTDB_PostgresContext
*/
struct TALER_MerchantPublicKeyP current_merchant_pub;
- /**
- * How many times have we connected to the DB.
- */
- uint64_t prep_gen;
-
};
/**
+ * How many times have we connected to the DB.
+ */
+extern uint64_t TMH_PG_prep_gen_;
+
+
+/**
* Prepares SQL statement @a sql under @a name for
* connection @a pg once.
* Returns with #GNUNET_DB_STATUS_HARD_ERROR on failure.
@@ -91,14 +92,14 @@ struct TALER_MERCHANTDB_PostgresContext
#define PREPARE(pg,name,sql) \
do { \
static unsigned long long gen; \
- \
- if (gen < pg->prep_gen) \
+ \
+ if (gen < TMH_PG_prep_gen_) \
{ \
struct GNUNET_PQ_PreparedStatement ps[] = { \
GNUNET_PQ_make_prepare (name, sql), \
GNUNET_PQ_PREPARED_STATEMENT_END \
}; \
- \
+ \
if (GNUNET_OK != \
GNUNET_PQ_prepare_statements (pg->conn, \
ps)) \
@@ -106,7 +107,7 @@ struct TALER_MERCHANTDB_PostgresContext
GNUNET_break (0); \
return GNUNET_DB_STATUS_HARD_ERROR; \
} \
- gen = pg->prep_gen; \
+ gen = TMH_PG_prep_gen_; \
} \
} while (0)
diff --git a/src/backenddb/pg.c b/src/backenddb/pg.c
@@ -34,6 +34,10 @@ struct TALER_MERCHANTDB_PostgresContext;
#include "merchantdb_lib.h"
#include "helper.h"
+/**
+ * How many times have we connected to the DB.
+ */
+uint64_t TMH_PG_prep_gen_;
/**
* Function called each time we connect or reconnect to the
@@ -59,7 +63,7 @@ reconnect_cb (struct TALER_MERCHANTDB_PostgresContext *pg,
GNUNET_break (0);
return;
}
- pg->prep_gen++;
+ TMH_PG_prep_gen_++;
}