summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/pg_helper.h')
-rw-r--r--src/exchangedb/pg_helper.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/exchangedb/pg_helper.h b/src/exchangedb/pg_helper.h
index e0a4be49d..c63c9111d 100644
--- a/src/exchangedb/pg_helper.h
+++ b/src/exchangedb/pg_helper.h
@@ -83,10 +83,10 @@ struct PostgresClosure
unsigned long long prep_gen;
/**
- * Did we initialize the prepared statements
- * for this session? (To be replaced with @e prep_gen.)
+ * Number of purses we allow to be opened concurrently
+ * for one year per annual fee payment.
*/
- bool init;
+ uint32_t def_purse_limit;
};
@@ -102,12 +102,22 @@ struct PostgresClosure
*/
#define PREPARE(pg,name,sql) \
do { \
- static unsigned long long prep_cnt; \
+ static struct { \
+ unsigned long long cnt; \
+ struct PostgresClosure *pg; \
+ } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \
+ unsigned int off = 0; \
\
- if (prep_cnt < pg->prep_gen) \
+ while ( (NULL != preps[off].pg) && \
+ (pg != preps[off].pg) && \
+ (off < sizeof(preps) / sizeof(*preps)) ) \
+ off++; \
+ GNUNET_assert (off < \
+ sizeof(preps) / sizeof(*preps)); \
+ if (preps[off].cnt < pg->prep_gen) \
{ \
struct GNUNET_PQ_PreparedStatement ps[] = { \
- GNUNET_PQ_make_prepare (name, sql, 0), \
+ GNUNET_PQ_make_prepare (name, sql), \
GNUNET_PQ_PREPARED_STATEMENT_END \
}; \
\
@@ -118,7 +128,8 @@ struct PostgresClosure
GNUNET_break (0); \
return GNUNET_DB_STATUS_HARD_ERROR; \
} \
- prep_cnt = pg->prep_gen; \
+ preps[off].pg = pg; \
+ preps[off].cnt = pg->prep_gen; \
} \
} while (0)
@@ -130,19 +141,8 @@ struct PostgresClosure
* @param field name of the database field to fetch amount from
* @param[out] amountp pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) TALER_PQ_result_spec_amount ( \
- field,pg->currency,amountp)
-
-
-/**
- * Wrapper macro to add the currency from the plugin's state
- * when fetching amounts from the database. NBO variant.
- *
- * @param field name of the database field to fetch amount from
- * @param[out] amountp pointer to amount to set
- */
-#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field, \
- amountp) TALER_PQ_result_spec_amount_nbo ( \
+#define TALER_PQ_RESULT_SPEC_AMOUNT(field, \
+ amountp) TALER_PQ_result_spec_amount ( \
field,pg->currency,amountp)