From 94e5193bffd5b2107710ba4fab0405ba22ea6dcf Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Fri, 28 Jul 2023 16:19:21 +0200 Subject: [pq] added helper to load oids of composite types - TALER_PQ_load_oids_for_composite_types added - Called during postgres-initialization --- src/include/taler_pq_lib.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/include/taler_pq_lib.h') diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h index 43561703..051962b2 100644 --- a/src/include/taler_pq_lib.h +++ b/src/include/taler_pq_lib.h @@ -19,15 +19,42 @@ * @author Sree Harsha Totakura * @author Florian Dold * @author Christian Grothoff + * @author Özgür Kesim */ #ifndef TALER_PQ_LIB_H_ #define TALER_PQ_LIB_H_ #include #include +#include #include #include "taler_util.h" +/** + * Enumerates the composite types that Taler defines in Postgres. + * The corresponding OIDs (which are assigned by postgres at time of + * declaration) are stored in TALER_PQ_CompositeOIDs. + */ +enum TALER_PQ_CompositeType +{ + TALER_PQ_CompositeAmount, + TALER_PQ_CompositeMAX /* MUST be last */ +}; + +/** + * The correspondence of the Composite types and their OID in Postgres + */ +extern Oid TALER_PQ_CompositeOIDs[TALER_PQ_CompositeMAX]; + +/** + * Initialize the list of OIDs in TALER_PQ_CompositeOIDs. MUST be called + * before any composite type is used in arrays-specs/-params. + * + * @return GNUNET_SYSERR on failure + */ +enum GNUNET_GenericReturnValue +TALER_PQ_load_oids_for_composite_types (struct GNUNET_PQ_Context *db); + /** * Generate query parameter for a currency, consisting of the three * components "value", "fraction" and "currency" in this order. The -- cgit v1.2.3