25#ifndef GNUNET_SQ_LIB_H
26#define GNUNET_SQ_LIB_H
87#define GNUNET_SQ_query_param_end { NULL, NULL, NULL, 0, 0 }
117#define GNUNET_SQ_query_param_auto_from_type( \
118 x) GNUNET_SQ_query_param_fixed_size ((x), sizeof(*(x)))
302#define GNUNET_SQ_result_spec_end { NULL, NULL, NULL, NULL, 0, NULL, 0 }
335#define GNUNET_SQ_result_spec_auto_from_type( \
336 dst) GNUNET_SQ_result_spec_fixed_size ((dst), sizeof(*(dst)))
479#define GNUNET_SQ_PREPARE_END { NULL, NULL }
491 sqlite3_stmt **
pstmt);
531#define GNUNET_SQ_EXECUTE_STATEMENT_END { NULL, GNUNET_SYSERR }
static struct GNUNET_PEERSTORE_Handle * ps
Handle to the PEERSTORE service.
static char * data
The data to insert into the dht.
static int result
Global testing status.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x)
Generate query parameter for an RSA public key.
struct GNUNET_SQ_PrepareStatement GNUNET_SQ_make_prepare(const char *sql, sqlite3_stmt **pstmt)
Create a struct GNUNET_SQ_PrepareStatement
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa)
RSA public key expected.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x)
Generate query parameter for an RSA signature.
struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_execute(const char *sql)
Create a struct GNUNET_SQ_ExecuteStatement where errors are fatal.
struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_try_execute(const char *sql)
Create a struct GNUNET_SQ_ExecuteStatement where errors should be tolerated.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_fixed_size(const void *ptr, size_t ptr_size)
Generate query parameter for a buffer ptr of ptr_size bytes.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig)
RSA signature expected.
enum GNUNET_GenericReturnValue GNUNET_SQ_extract_result(sqlite3_stmt *result, struct GNUNET_SQ_ResultSpec *rs)
Extract results from a query result according to the given specification.
void(* GNUNET_SQ_ResultCleanup)(void *cls)
Function called to clean up memory allocated by a GNUNET_SQ_ResultConverter.
void GNUNET_SQ_cleanup_result(struct GNUNET_SQ_ResultSpec *rs)
Free all memory that was allocated in rs during GNUNET_SQ_extract_result().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at)
Absolute time expected.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x)
Generate query parameter for an absolute time value.
enum GNUNET_GenericReturnValue(* GNUNET_SQ_QueryConverter)(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint32(const uint32_t *x)
Generate query parameter for an uint32_t in host byte order.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_string(char **dst)
0-terminated string expected.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint64(const uint64_t *x)
Generate query parameter for an uint16_t in host byte order.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint16(uint16_t *u16)
uint16_t expected.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at)
Absolute time expected.
enum GNUNET_GenericReturnValue GNUNET_SQ_exec_statements(sqlite3 *dbh, const struct GNUNET_SQ_ExecuteStatement *es)
Request execution of an array of statements es from Postgres.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint32(uint32_t *u32)
uint32_t expected.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_fixed_size(void *dst, size_t dst_size)
Fixed-size result expected.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint16(const uint16_t *x)
Generate query parameter for an uint16_t in host byte order.
enum GNUNET_GenericReturnValue GNUNET_SQ_prepare(sqlite3 *dbh, const struct GNUNET_SQ_PrepareStatement *ps)
Prepare all statements given in the (NULL,NULL)-terminated array at ps.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x)
Generate query parameter for an absolute time value.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_variable_size(void **dst, size_t *sptr)
Variable-size result expected.
enum GNUNET_GenericReturnValue(* GNUNET_SQ_ResultConverter)(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract data from a Postgres database result at row row.
enum GNUNET_GenericReturnValue GNUNET_SQ_bind(sqlite3_stmt *stmt, const struct GNUNET_SQ_QueryParam *params)
Execute binding operations for a prepared statement.
void GNUNET_SQ_reset(sqlite3 *dbh, sqlite3_stmt *stmt)
Reset stmt and log error.
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_string(const char *ptr)
Generate query parameter for a string.
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint64(uint64_t *u64)
uint64_t expected.
GNUNET_GenericReturnValue
Named constants for return values.
The public information of an RSA key pair.
Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements().
bool ignore_errors
Should we ignore errors?
const char * sql
Actual SQL statement.
Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements().
const char * sql
Actual SQL statement.
sqlite3_stmt ** pstmt
Where to store handle?
Description of a DB query parameter.
const void * data
Data or NULL.
void * conv_cls
Closure for conv.
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
unsigned int num_params
Number of parameters eaten by this operation.
Description of a DB result cell.
size_t * result_size
Where to store actual size of the result.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
GNUNET_SQ_ResultCleanup cleaner
Function to clean up result data, NULL if cleanup is not necessary.
void * cls
Closure for conv and cleaner.
unsigned int num_params
Number of parameters (columns) eaten by this operation.
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...
void * dst
Destination for the data.
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.