GNUnet  0.19.2
gnunet_pq_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2016, 2017, 2020-2022 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
25 #ifndef GNUNET_PQ_LIB_H
26 #define GNUNET_PQ_LIB_H
27 
28 
29 #include <libpq-fe.h>
30 #include "gnunet_util_lib.h"
31 #include "gnunet_db_lib.h"
32 
33 /* ************************* pq_query_helper.c functions ************************ */
34 
35 
50 typedef int
51 (*GNUNET_PQ_QueryConverter) (void *cls,
52  const void *data,
53  size_t data_len,
54  void *param_values[],
55  int param_lengths[],
56  int param_formats[],
57  unsigned int param_length,
58  void *scratch[],
59  unsigned int scratch_length);
60 
61 
66 {
71 
75  void *conv_cls;
76 
80  const void *data;
81 
85  size_t size;
86 
90  unsigned int num_params;
91 
92 };
93 
94 
98 #define GNUNET_PQ_query_param_end \
99  { \
100  .conv = NULL, \
101  .conv_cls = NULL, \
102  .data = NULL, \
103  .size = 0, \
104  .num_params = 0 \
105  }
106 
107 
115 
116 
126 GNUNET_PQ_query_param_fixed_size (const void *ptr,
127  size_t ptr_size);
128 
129 
137 GNUNET_PQ_query_param_string (const char *ptr);
138 
139 
148 
149 
154 {
158  unsigned int ndims;
159 
163  unsigned int *lens;
164 
169  const struct GNUNET_PQ_QueryParam *ae;
170 
171 };
172 
173 
181 
182 
190 #define GNUNET_PQ_query_param_auto_from_type(x) \
191  GNUNET_PQ_query_param_fixed_size ((x), sizeof(*(x)))
192 
193 
203  const struct GNUNET_CRYPTO_RsaPublicKey *x);
204 
205 
215  const struct GNUNET_CRYPTO_RsaSignature *x);
216 
217 
227 
228 
238 
239 
249 
250 
260  const struct GNUNET_TIME_AbsoluteNBO *x);
261 
262 
272  const struct GNUNET_TIME_TimestampNBO *x);
273 
274 
282 GNUNET_PQ_query_param_uint16 (const uint16_t *x);
283 
284 
292 GNUNET_PQ_query_param_uint32 (const uint32_t *x);
293 
294 
302 GNUNET_PQ_query_param_uint64 (const uint64_t *x);
303 
304 
305 /* ************************* pq_result_helper.c functions ************************ */
306 
307 
322 typedef enum GNUNET_GenericReturnValue
323 (*GNUNET_PQ_ResultConverter)(void *cls,
324  PGresult *result,
325  int row,
326  const char *fname,
327  size_t *dst_size,
328  void *dst);
329 
330 
338 typedef void
339 (*GNUNET_PQ_ResultCleanup) (void *cls,
340  void *rd);
341 
342 
347 {
352 
358 
362  void *cls;
363 
367  void *dst;
368 
374  size_t dst_size;
375 
379  const char *fname;
380 
384  size_t *result_size;
385 
390 
397  bool *is_null;
398 
399 };
400 
401 
407 #define GNUNET_PQ_result_spec_end \
408  { \
409  .conv = NULL, \
410  .cleaner = NULL, \
411  .cls = NULL, \
412  .dst = NULL, \
413  .dst_size = 0, \
414  .fname = NULL, \
415  .result_size = NULL, \
416  .is_nullable = false, \
417  .is_null = NULL \
418  }
419 
420 
433  bool *is_null);
434 
435 
446  void **dst,
447  size_t *sptr);
448 
449 
460  void *dst,
461  size_t dst_size);
462 
463 
471 #define GNUNET_PQ_result_spec_auto_from_type(name, dst) \
472  GNUNET_PQ_result_spec_fixed_size (name, (dst), sizeof(*(dst)))
473 
474 
484  char **dst);
485 
486 
495 GNUNET_PQ_result_spec_bool (const char *name,
496  bool *dst);
497 
498 
508  struct GNUNET_CRYPTO_RsaPublicKey **rsa);
509 
510 
520  struct GNUNET_CRYPTO_RsaSignature **sig);
521 
522 
532  struct GNUNET_TIME_Absolute *at);
533 
534 
544  struct GNUNET_TIME_Timestamp *t);
545 
546 
556  struct GNUNET_TIME_Relative *rt);
557 
558 
568  struct GNUNET_TIME_AbsoluteNBO *at);
569 
570 
580  struct GNUNET_TIME_TimestampNBO *tn);
581 
582 
592  uint16_t *u16);
593 
594 
604  uint32_t *u32);
605 
606 
616  uint64_t *u64);
617 
618 
619 /* ************************* pq.c functions ************************ */
620 
624 struct GNUNET_PQ_Context;
625 
626 
636 PGresult *
638  const char *name,
639  const struct GNUNET_PQ_QueryParam *params);
640 
641 
654  struct GNUNET_PQ_ResultSpec *rs,
655  int row);
656 
657 
664 void
666 
667 
668 /* ******************** pq_eval.c functions ************** */
669 
670 
686  const char *statement_name,
687  PGresult *result);
688 
689 
708  const char *statement_name,
709  const struct GNUNET_PQ_QueryParam *params);
710 
711 
720 typedef void
721 (*GNUNET_PQ_PostgresResultHandler) (void *cls,
722  PGresult *result,
723  unsigned int num_results);
724 
725 
743  const char *statement_name,
744  const struct GNUNET_PQ_QueryParam *params,
746  void *rh_cls);
747 
748 
766  struct GNUNET_PQ_Context *db,
767  const char *statement_name,
768  const struct GNUNET_PQ_QueryParam *params,
769  struct GNUNET_PQ_ResultSpec *rs);
770 
771 
772 /* ******************** pq_prepare.c functions ************** */
773 
774 
780 {
784  const char *name;
785 
789  const char *sql;
790 
791 };
792 
793 
797 #define GNUNET_PQ_PREPARED_STATEMENT_END \
798  { \
799  NULL, NULL \
800  }
801 
802 
811 GNUNET_PQ_make_prepare (const char *name,
812  const char *sql);
813 
814 
826  const struct GNUNET_PQ_PreparedStatement *ps);
827 
828 
841  const struct GNUNET_PQ_PreparedStatement *ps);
842 
843 
844 /* ******************** pq_exec.c functions ************** */
845 
846 
852 {
856  const char *sql;
857 
862 };
863 
864 
868 #define GNUNET_PQ_EXECUTE_STATEMENT_END \
869  { \
870  NULL, GNUNET_SYSERR \
871  }
872 
873 
881 GNUNET_PQ_make_execute (const char *sql);
882 
883 
892 GNUNET_PQ_make_try_execute (const char *sql);
893 
894 
906  const struct GNUNET_PQ_ExecuteStatement *es);
907 
908 
909 /* ******************** pq_connect.c functions ************** */
910 
911 
916 {
921 
927 
932 };
933 
934 
957 struct GNUNET_PQ_Context *
958 GNUNET_PQ_connect (const char *config_str,
959  const char *load_path,
960  const struct GNUNET_PQ_ExecuteStatement *es,
961  const struct GNUNET_PQ_PreparedStatement *ps);
962 
963 
976  const char *buf);
977 
978 
1003 struct GNUNET_PQ_Context *
1004 GNUNET_PQ_connect2 (const char *config_str,
1005  const char *load_path,
1006  const char *auto_suffix,
1007  const struct GNUNET_PQ_ExecuteStatement *es,
1008  const struct GNUNET_PQ_PreparedStatement *ps,
1009  enum GNUNET_PQ_Options flags);
1010 
1011 
1029 struct GNUNET_PQ_Context *
1031  const char *section,
1032  const char *load_path_suffix,
1033  const struct GNUNET_PQ_ExecuteStatement *es,
1034  const struct GNUNET_PQ_PreparedStatement *ps);
1035 
1036 
1055 struct GNUNET_PQ_Context *
1057  const char *section,
1058  const char *load_path_suffix,
1059  const struct GNUNET_PQ_ExecuteStatement *es,
1060  const struct GNUNET_PQ_PreparedStatement *ps,
1061  enum GNUNET_PQ_Options flags);
1062 
1063 
1069 void
1071 
1072 
1078 void
1080 
1081 
1099 struct GNUNET_DB_EventHandler *
1101  const struct GNUNET_DB_EventHeaderP *es,
1104  void *cb_cls);
1105 
1106 
1118 void
1120 
1121 
1136 void
1138  const struct GNUNET_DB_EventHeaderP *es,
1139  const void *extra,
1140  size_t extra_size);
1141 
1142 
1150 char *
1152 
1153 
1165  const char *load_path);
1166 
1167 
1174 void
1176 
1177 
1178 #endif /* GNUNET_PQ_LIB_H_ */
1179 
1180 /* end of include/gnunet_pq_lib.h */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
uint32_t data
The data value.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static int result
Global testing status.
static struct GNUNET_FS_DirectoryBuilder * db
Definition: gnunet-search.c:97
static char buf[2048]
static struct GNUNET_SCHEDULER_Task * t
Main task.
shared definitions for transactional databases
void(* GNUNET_DB_EventCallback)(void *cls, const void *extra, size_t extra_size)
Function called on events received from Postgres.
Definition: gnunet_db_lib.h:80
GNUNET_DB_QueryStatus
Status code returned from functions running database commands.
Definition: gnunet_db_lib.h:37
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_fixed_size(const void *ptr, size_t ptr_size)
Generate query parameter for a buffer ptr of ptr_size bytes.
void(* GNUNET_PQ_PostgresResultHandler)(void *cls, PGresult *result, unsigned int num_results)
Function to be called with the results of a SELECT statement that has returned num_results results.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint64(const uint64_t *x)
Generate query parameter for an uint16_t in host byte order.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_timestamp_nbo(const char *name, struct GNUNET_TIME_TimestampNBO *tn)
Timestamp expected.
void GNUNET_PQ_reconnect(struct GNUNET_PQ_Context *db)
Reinitialize the database db.
Definition: pq_connect.c:325
enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_multi_select(struct GNUNET_PQ_Context *db, const char *statement_name, const struct GNUNET_PQ_QueryParam *params, GNUNET_PQ_PostgresResultHandler rh, void *rh_cls)
Execute a named prepared statement that is a SELECT statement which may return multiple results in co...
Definition: pq_eval.c:209
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint32(const char *name, uint32_t *u32)
uint32_t expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_null(void)
Generate query parameter to create a NULL value.
enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_singleton_select(struct GNUNET_PQ_Context *db, const char *statement_name, const struct GNUNET_PQ_QueryParam *params, struct GNUNET_PQ_ResultSpec *rs)
Execute a named prepared statement that is a SELECT statement which must return a single result in co...
Definition: pq_eval.c:258
void GNUNET_PQ_event_notify(struct GNUNET_PQ_Context *db, const struct GNUNET_DB_EventHeaderP *es, const void *extra, size_t extra_size)
Notify all that listen on es of an event.
Definition: pq_event.c:537
enum GNUNET_GenericReturnValue GNUNET_PQ_run_sql(struct GNUNET_PQ_Context *db, const char *load_path)
Within the db context, run all the SQL files from the load_path from 0000-9999.sql (as long as the fi...
Definition: pq_connect.c:223
struct GNUNET_DB_EventHandler * GNUNET_PQ_event_listen(struct GNUNET_PQ_Context *db, const struct GNUNET_DB_EventHeaderP *es, struct GNUNET_TIME_Relative timeout, GNUNET_DB_EventCallback cb, void *cb_cls)
Register callback to be invoked on events of type es.
Definition: pq_event.c:445
struct GNUNET_PQ_ExecuteStatement GNUNET_PQ_make_execute(const char *sql)
Create a struct GNUNET_PQ_ExecuteStatement where errors are fatal.
Definition: pq_exec.c:36
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x)
Generate query parameter for an absolute time value.
enum GNUNET_GenericReturnValue GNUNET_PQ_prepare_once(struct GNUNET_PQ_Context *db, const struct GNUNET_PQ_PreparedStatement *ps)
Request creation of prepared statements ps from Postgres, but do not automatically re-prepare the sta...
Definition: pq_prepare.c:43
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_relative_time(const struct GNUNET_TIME_Relative *x)
Generate query parameter for a relative time value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint16(const uint16_t *x)
Generate query parameter for an uint16_t in host byte order.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_fixed_size(const char *name, void *dst, size_t dst_size)
Fixed-size result expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x)
Generate query parameter for an RSA public key.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_bool(const char *name, bool *dst)
boolean expected.
void(* GNUNET_PQ_ResultCleanup)(void *cls, void *rd)
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
enum GNUNET_GenericReturnValue GNUNET_PQ_exec_statements(struct GNUNET_PQ_Context *db, const struct GNUNET_PQ_ExecuteStatement *es)
Request execution of an array of statements es from Postgres.
Definition: pq_exec.c:67
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time_nbo(const char *name, struct GNUNET_TIME_AbsoluteNBO *at)
Absolute time expected.
enum GNUNET_GenericReturnValue GNUNET_PQ_prepare_statements(struct GNUNET_PQ_Context *db, const struct GNUNET_PQ_PreparedStatement *ps)
Request creation of prepared statements ps from Postgres.
Definition: pq_prepare.c:88
struct GNUNET_PQ_Context * GNUNET_PQ_connect2(const char *config_str, const char *load_path, const char *auto_suffix, const struct GNUNET_PQ_ExecuteStatement *es, const struct GNUNET_PQ_PreparedStatement *ps, enum GNUNET_PQ_Options flags)
Create a connection to the Postgres database using config_str for the configuration.
Definition: pq_connect.c:85
int(* GNUNET_PQ_QueryConverter)(void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length)
Function called to convert input argument into SQL parameters.
Definition: gnunet_pq_lib.h:51
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x)
Generate query parameter for an absolute time value.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array(const struct GNUNET_PQ_ArraySpec *as)
Generate query parameter for an array.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint64(const char *name, uint64_t *u64)
uint64_t expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_bool(bool b)
Pass a boolean into a query.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_string(const char *name, char **dst)
0-terminated string expected.
void GNUNET_PQ_reconnect_if_down(struct GNUNET_PQ_Context *db)
Reinitialize the database db if the connection is down.
Definition: pq_connect.c:313
enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_result(struct GNUNET_PQ_Context *db, const char *statement_name, PGresult *result)
Check the result's error code to see what happened.
Definition: pq_eval.c:59
void GNUNET_PQ_disconnect(struct GNUNET_PQ_Context *db)
Disconnect from the database, destroying the prepared statements and releasing other associated resou...
Definition: pq_connect.c:542
enum GNUNET_GenericReturnValue(* GNUNET_PQ_ResultConverter)(void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst)
Extract data from a Postgres database result at row row.
struct GNUNET_PQ_Context * GNUNET_PQ_connect(const char *config_str, const char *load_path, const struct GNUNET_PQ_ExecuteStatement *es, const struct GNUNET_PQ_PreparedStatement *ps)
Create a connection to the Postgres database using config_str for the configuration.
Definition: pq_connect.c:68
PGresult * GNUNET_PQ_exec_prepared(struct GNUNET_PQ_Context *db, const char *name, const struct GNUNET_PQ_QueryParam *params)
Execute a prepared statement.
Definition: pq.c:32
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_allow_null(struct GNUNET_PQ_ResultSpec rs, bool *is_null)
Allow NULL value to be found in the database for the given value.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time(const char *name, struct GNUNET_TIME_Absolute *at)
Absolute time expected.
struct GNUNET_PQ_Context * GNUNET_PQ_connect_with_cfg(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *load_path_suffix, const struct GNUNET_PQ_ExecuteStatement *es, const struct GNUNET_PQ_PreparedStatement *ps)
Connect to a postgres database using the configuration option "CONFIG" in section.
Definition: pq_connect.c:477
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint16(const char *name, uint16_t *u16)
uint16_t expected.
struct GNUNET_PQ_PreparedStatement GNUNET_PQ_make_prepare(const char *name, const char *sql)
Create a struct GNUNET_PQ_PreparedStatement.
Definition: pq_prepare.c:30
struct GNUNET_PQ_ExecuteStatement GNUNET_PQ_make_try_execute(const char *sql)
Create a struct GNUNET_PQ_ExecuteStatement where errors should be tolerated.
Definition: pq_exec.c:55
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint32(const uint32_t *x)
Generate query parameter for an uint32_t in host byte order.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_relative_time(const char *name, struct GNUNET_TIME_Relative *rt)
Relative time expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp(const struct GNUNET_TIME_Timestamp *x)
Generate query parameter for a timestamp.
GNUNET_PQ_Options
Flags to control PQ operation.
@ GNUNET_PQ_FLAG_DROP
Dropping database.
@ GNUNET_PQ_FLAG_CHECK_CURRENT
Check database version is current.
@ GNUNET_PQ_FLAG_NONE
Traditional default.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_variable_size(const char *name, void **dst, size_t *sptr)
Variable-size result expected.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_public_key(const char *name, struct GNUNET_CRYPTO_RsaPublicKey **rsa)
RSA public key expected.
void GNUNET_PQ_cleanup_result(struct GNUNET_PQ_ResultSpec *rs)
Free all memory that was allocated in rs during GNUNET_PQ_extract_result().
Definition: pq.c:122
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp_nbo(const struct GNUNET_TIME_TimestampNBO *x)
Generate query parameter for a timestamp in NBO.
enum GNUNET_GenericReturnValue GNUNET_PQ_extract_result(PGresult *result, struct GNUNET_PQ_ResultSpec *rs, int row)
Extract results from a query result according to the given specification.
Definition: pq.c:132
enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_non_select(struct GNUNET_PQ_Context *db, const char *statement_name, const struct GNUNET_PQ_QueryParam *params)
Execute a named prepared statement that is NOT a SELECT statement in connection using the given param...
Definition: pq_eval.c:164
void GNUNET_PQ_event_listen_cancel(struct GNUNET_DB_EventHandler *eh)
Stop notifications.
Definition: pq_event.c:487
struct GNUNET_PQ_Context * GNUNET_PQ_connect_with_cfg2(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *load_path_suffix, const struct GNUNET_PQ_ExecuteStatement *es, const struct GNUNET_PQ_PreparedStatement *ps, enum GNUNET_PQ_Options flags)
Connect to a postgres database using the configuration option "CONFIG" in section.
Definition: pq_connect.c:493
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_signature(const char *name, struct GNUNET_CRYPTO_RsaSignature **sig)
RSA signature expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_string(const char *ptr)
Generate query parameter for a string.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_timestamp(const char *name, struct GNUNET_TIME_Timestamp *t)
Timestamp expected.
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x)
Generate query parameter for an RSA signature.
enum GNUNET_GenericReturnValue GNUNET_PQ_exec_sql(struct GNUNET_PQ_Context *db, const char *buf)
Execute SQL statements from buf against db.
Definition: pq_connect.c:143
char * GNUNET_PG_get_event_notify_channel(const struct GNUNET_DB_EventHeaderP *es)
Compute the channel that one should notify upon for the given event specification.
Definition: pq_event.c:522
GNUNET_GenericReturnValue
Named constants for return values.
const char * name
The public information of an RSA key pair.
Definition: crypto_rsa.c:53
an RSA signature
Definition: crypto_rsa.c:65
Handle for an active LISTENer to the database.
Definition: pq_event.c:34
void * cb_cls
Closure for cb.
Definition: pq_event.c:48
GNUNET_DB_EventCallback cb
Function to call on events.
Definition: pq_event.c:43
Header of a structure that describes an event channel we may subscribe to or notify on.
Definition: gnunet_db_lib.h:92
Information for an array argument.
unsigned int * lens
Array of ndims lengths of the array.
const struct GNUNET_PQ_QueryParam * ae
One-dimensional array of pointers to conversion functions for the elements in the array.
unsigned int ndims
Number of dimensions of the array.
Handle to Postgres database.
Definition: pq.h:36
struct GNUNET_PQ_ExecuteStatement * es
Statements to execute upon connection.
Definition: pq.h:45
enum GNUNET_PQ_Options flags
Flags controlling the connection.
Definition: pq.h:100
char * load_path
Path to load SQL files from.
Definition: pq.h:70
struct GNUNET_PQ_PreparedStatement * ps
Prepared statements.
Definition: pq.h:50
char * config_str
Configuration to use to connect to the DB.
Definition: pq.h:65
char * auto_suffix
Suffix to append to path to load on startup.
Definition: pq.h:75
Information needed to run a list of SQL statements using GNUNET_PQ_exec_statements().
const char * sql
Actual SQL statement.
int ignore_errors
Should we ignore errors?
Information needed to prepare a list of SQL statements using GNUNET_PQ_prepare_statements().
const char * name
Name of the statement.
const char * sql
Actual SQL statement.
Description of a DB query parameter.
Definition: gnunet_pq_lib.h:66
void * conv_cls
Closure for conv.
Definition: gnunet_pq_lib.h:75
const void * data
Data or NULL.
Definition: gnunet_pq_lib.h:80
GNUNET_PQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_pq_lib.h:70
unsigned int num_params
Number of parameters eaten by this operation.
Definition: gnunet_pq_lib.h:90
size_t size
Size of data.
Definition: gnunet_pq_lib.h:85
Description of a DB result cell.
const char * fname
Field name of the desired result.
bool * is_null
Points to a location where we should store "true" if the result found is NULL, and otherwise "false".
void * dst
Destination for the data.
bool is_nullable
True if NULL is allowed for a value in the database.
void * cls
Closure for conv and cleaner.
GNUNET_PQ_ResultConverter conv
What is the format of the result?
size_t * result_size
Where to store actual size of the result.
GNUNET_PQ_ResultCleanup cleaner
Function to clean up result data, NULL if cleanup is not necessary.
size_t dst_size
Allowed size for the data, 0 for variable-size (in this case, the type of dst is a void ** and we nee...
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
Time for timestamps used by GNUnet, in seconds and in network byte order.
Rounded time for timestamps used by GNUnet, in seconds.