diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-28 16:19:21 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-28 16:19:21 +0200 |
commit | 94e5193bffd5b2107710ba4fab0405ba22ea6dcf (patch) | |
tree | 03204300c92e44808e86ad86ccb6872d15b0b0a0 /src/include/taler_pq_lib.h | |
parent | 1c923855a31b35e28706ba2fafa2d2bccc7ee775 (diff) |
[pq] added helper to load oids of composite types
- TALER_PQ_load_oids_for_composite_types added
- Called during postgres-initialization
Diffstat (limited to 'src/include/taler_pq_lib.h')
-rw-r--r-- | src/include/taler_pq_lib.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h index 43561703b..051962b2b 100644 --- a/src/include/taler_pq_lib.h +++ b/src/include/taler_pq_lib.h @@ -19,16 +19,43 @@ * @author Sree Harsha Totakura <sreeharsha@totakura.in> * @author Florian Dold * @author Christian Grothoff + * @author Özgür Kesim */ #ifndef TALER_PQ_LIB_H_ #define TALER_PQ_LIB_H_ #include <libpq-fe.h> #include <jansson.h> +#include <gnunet/gnunet_common.h> #include <gnunet/gnunet_pq_lib.h> #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 * types must be a 64-bit integer, 32-bit integer and a |