aboutsummaryrefslogtreecommitdiff
path: root/src/pq/pq_query_helper.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-11-28 15:38:07 +0100
committerÖzgür Kesim <oec-taler@kesim.org>2023-11-28 15:38:07 +0100
commitd15fd5add80707b30b874ecb207e2dcad29692cc (patch)
tree5408975ce554b801cebb471670b113bda40c1481 /src/pq/pq_query_helper.c
parentfd2f18d4fbf8b84eb9444972b1660bb7712d192e (diff)
downloadexchange-d15fd5add80707b30b874ecb207e2dcad29692cc.tar.xz
[pq] add support for array of struct GNUNET_HashCode
Diffstat (limited to 'src/pq/pq_query_helper.c')
-rw-r--r--src/pq/pq_query_helper.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index f66844515..24bf054da 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -846,14 +846,14 @@ qconv_array (
same_sized = (0 != meta->same_size);
#define RETURN_UNLESS(cond) \
- do { \
- if (! (cond)) \
- { \
- GNUNET_break ((cond)); \
- noerror = false; \
- goto DONE; \
- } \
- } while (0)
+ do { \
+ if (! (cond)) \
+ { \
+ GNUNET_break ((cond)); \
+ noerror = false; \
+ goto DONE; \
+ } \
+ } while (0)
/* Calculate sizes and check bounds */
{
@@ -1037,6 +1037,15 @@ qconv_array (
sizeof(struct TALER_DenominationHashP));
break;
}
+ case TALER_PQ_array_of_hash_code:
+ {
+ const struct GNUNET_HashCode *hashes = data;
+
+ GNUNET_memcpy (out,
+ &hashes[i],
+ sizeof(struct GNUNET_HashCode));
+ break;
+ }
default:
{
GNUNET_assert (0);
@@ -1171,6 +1180,26 @@ TALER_PQ_query_param_array_denom_hash (
struct GNUNET_PQ_QueryParam
+TALER_PQ_query_param_array_hash_code (
+ size_t num,
+ const struct GNUNET_HashCode *hashes,
+ struct GNUNET_PQ_Context *db)
+{
+ Oid oid;
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_PQ_get_oid_by_name (db, "gnunet_hashcode", &oid));
+ return query_param_array_generic (num,
+ true,
+ hashes,
+ NULL,
+ sizeof(struct GNUNET_HashCode),
+ TALER_PQ_array_of_hash_code,
+ oid,
+ NULL);
+}
+
+
+struct GNUNET_PQ_QueryParam
TALER_PQ_query_param_array_amount (
size_t num,
const struct TALER_Amount *amounts,