summaryrefslogtreecommitdiff
path: root/src/include/taler_pq_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-06 11:47:12 +0200
committerChristian Grothoff <christian@grothoff.org>2015-05-06 11:47:12 +0200
commit74a21a5259f9dbcb3a9df887cefe70de0567fd63 (patch)
treea9e8f86e25a361cbb7926b584df2d383948cc801 /src/include/taler_pq_lib.h
parentf8723b9b5d6a47c0d256ac6cf7fcd984a6e10484 (diff)
downloadexchange-74a21a5259f9dbcb3a9df887cefe70de0567fd63.tar.gz
exchange-74a21a5259f9dbcb3a9df887cefe70de0567fd63.tar.bz2
exchange-74a21a5259f9dbcb3a9df887cefe70de0567fd63.zip
fixing #3768, using new pq API more
Diffstat (limited to 'src/include/taler_pq_lib.h')
-rw-r--r--src/include/taler_pq_lib.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index d31ecf84c..6bf5c0c82 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -102,12 +102,15 @@ struct TALER_PQ_QueryParam
#define TALER_PQ_QUERY_PARAM_PTR(x) { TALER_PQ_QF_VARSIZE_BLOB, x, sizeof (*(x)) }
/**
- * Generate fixed-size query parameter with size determined
- * by variable type.
+ * Generate query parameter for a currency, consisting of the three
+ * components "value", "fraction" and "currency" in this order. The
+ * types must be a 64-bit integer, 32-bit integer and a
+ * TALER_CURRENCY_LEN-sized BLOB/VARCHAR respectively.
*
- * @param x pointer to the query parameter to pass.
+ * @param x pointer to the query parameter to pass, must be
+ * a variable of type `struct TALER_AmountNBO`.
*/
-#define TALER_PQ_QUERY_PARAM_AMOUNT_NBO(x) { TALER_PQ_QF_AMOUNT_NBO, x, sizeof (*(x)) }
+#define TALER_PQ_QUERY_PARAM_AMOUNT_NBO(x) { TALER_PQ_QF_AMOUNT_NBO, &(x), sizeof (x) }
/**
@@ -135,7 +138,13 @@ enum TALER_PQ_ResultFormat
* We have a currency amount.
* Data points to a `struct TALER_AmountNBO`, size only used for checking.
*/
- TALER_PQ_RF_AMOUNT_NBO
+ TALER_PQ_RF_AMOUNT_NBO,
+
+ /**
+ * We have a currency amount.
+ * Data points to a `struct TALER_Amount`, size only used for checking.
+ */
+ TALER_PQ_RF_AMOUNT
};
@@ -213,6 +222,14 @@ struct TALER_PQ_ResultSpec
* Currency amount expected.
*
* @param name name of the field in the table
+ * @param amount a `struct TALER_AmountNBO` where to store the result
+ */
+#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(name, amount) {TALER_PQ_RF_AMOUNT_NBO, (void *) (&dst), sizeof (amount), (name), NULL }
+
+/**
+ * Currency amount expected.
+ *
+ * @param name name of the field in the table
* @param amount a `struct TALER_Amount` where to store the result
*/
#define TALER_PQ_RESULT_SPEC_AMOUNT(name, amount) {TALER_PQ_RF_AMOUNT, (void *) (&dst), sizeof (amount), (name), NULL }