aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-07-26 03:51:17 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-07-26 03:52:34 +0200
commitb14eee0fdd9c3f5283788fd60733b5a08d39a17f (patch)
tree6ba7336c658f0928a4fab24089f9af0060eac8ca
parenteffd970f95eb50bebbe4fed4b2343e192a1487f9 (diff)
downloadgnunet-b14eee0fdd9c3f5283788fd60733b5a08d39a17f.tar.gz
gnunet-b14eee0fdd9c3f5283788fd60733b5a08d39a17f.zip
pq: expose array-type->oid mapping via function
NEWS: added GNUNET_PQ_get_oid()
-rw-r--r--src/include/gnunet_pq_lib.h14
-rw-r--r--src/pq/pq_connect.c10
2 files changed, 23 insertions, 1 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 69cf84583..edb0519b0 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -31,13 +31,13 @@
31#include "gnunet_time_lib.h" 31#include "gnunet_time_lib.h"
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_db_lib.h" 33#include "gnunet_db_lib.h"
34#include "postgres_ext.h"
34 35
35/** 36/**
36 * Postgres context. 37 * Postgres context.
37 */ 38 */
38struct GNUNET_PQ_Context; 39struct GNUNET_PQ_Context;
39 40
40
41/* ************************* pq_query_helper.c functions ************************ */ 41/* ************************* pq_query_helper.c functions ************************ */
42 42
43 43
@@ -198,6 +198,18 @@ enum GNUNET_PQ_DataTypes
198}; 198};
199 199
200/** 200/**
201 * Returns the oid for a given datatype
202 *
203 * @param db The db-connection
204 * @param typ the Datatype
205 * @return The oid
206 */
207Oid
208GNUNET_PQ_get_oid (
209 const struct GNUNET_PQ_Context *db,
210 enum GNUNET_PQ_DataTypes typ);
211
212/**
201 * Generate query parameter for an array of bool in host byte order. 213 * Generate query parameter for an array of bool in host byte order.
202 * 214 *
203 * @param num Number of elements in @a elements 215 * @param num Number of elements in @a elements
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c
index 9493eb2d7..f30f989ea 100644
--- a/src/pq/pq_connect.c
+++ b/src/pq/pq_connect.c
@@ -420,6 +420,16 @@ get_array_type_oids (struct GNUNET_PQ_Context *db)
420} 420}
421 421
422 422
423Oid
424GNUNET_PQ_get_oid (
425 const struct GNUNET_PQ_Context *db,
426 enum GNUNET_PQ_DataTypes typ)
427{
428 GNUNET_assert (GNUNET_PQ_DATATYPE_MAX > typ);
429 return db->oids[typ];
430}
431
432
423void 433void
424GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db) 434GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db)
425{ 435{