aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-07-28 15:18:18 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-07-28 15:19:06 +0200
commit3e5ca0f158bd671e56690e034afcc26a1d10b00a (patch)
tree4744be3335f9f3769b735d66ca98cec29c0bff9c /src/include
parent526a111bd9dc0c83def348ebed63d527b7bbb4f4 (diff)
downloadgnunet-3e5ca0f158bd671e56690e034afcc26a1d10b00a.tar.gz
gnunet-3e5ca0f158bd671e56690e034afcc26a1d10b00a.zip
pq: added oid-by-name lookup API
NEWS: Added GNUNET_PQ_get_oid_by_name
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_pq_lib.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index edb0519b0..3b960df70 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -28,6 +28,7 @@
28 28
29#include <libpq-fe.h> 29#include <libpq-fe.h>
30#include <stdint.h> 30#include <stdint.h>
31#include "gnunet_common.h"
31#include "gnunet_time_lib.h" 32#include "gnunet_time_lib.h"
32#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
33#include "gnunet_db_lib.h" 34#include "gnunet_db_lib.h"
@@ -198,7 +199,7 @@ enum GNUNET_PQ_DataTypes
198}; 199};
199 200
200/** 201/**
201 * Returns the oid for a given datatype 202 * Returns the oid for a given, basic datatype
202 * 203 *
203 * @param db The db-connection 204 * @param db The db-connection
204 * @param typ the Datatype 205 * @param typ the Datatype
@@ -210,6 +211,38 @@ GNUNET_PQ_get_oid (
210 enum GNUNET_PQ_DataTypes typ); 211 enum GNUNET_PQ_DataTypes typ);
211 212
212/** 213/**
214 * Returns the oid for a given datatype by name.
215 *
216 * @param db The db-connection
217 * @param name The name of the datatype
218 * @param[out] oid The OID of the datatype.
219 * @return GNUNET_OK when the datatype was found, GNUNET_SYSERR otherwise
220 */
221enum GNUNET_GenericReturnValue
222GNUNET_PQ_get_oid_by_name (
223 struct GNUNET_PQ_Context *db,
224 const char *name,
225 Oid *oid);
226
227
228/**
229 * The header for a postgresql array in binary format. note that this a
230 * simplified special case of the general structure (which contains pointers),
231 * as we only support one-dimensional arrays.
232 *
233 * Note that all values must be in network-byte-order.
234 */
235struct GNUNET_PQ_ArrayHeader_P
236{
237 uint32_t ndim; /* number of dimensions. we only support ndim = 1 */
238 uint32_t has_null;
239 uint32_t oid; /* oid of the elements */
240 uint32_t dim; /* size of the array */
241 uint32_t lbound; /* index value of first element in the db (default: 1). */
242} __attribute__((packed));
243
244
245/**
213 * Generate query parameter for an array of bool in host byte order. 246 * Generate query parameter for an array of bool in host byte order.
214 * 247 *
215 * @param num Number of elements in @a elements 248 * @param num Number of elements in @a elements