helper functions for libpq (PostGres) interactions More...
Go to the source code of this file.
Functions | |
PGresult * | GNUNET_PQ_exec_prepared (struct GNUNET_PQ_Context *db, const char *name, const struct GNUNET_PQ_QueryParam *params) |
Execute a prepared statement. More... | |
void | GNUNET_PQ_cleanup_query_params_closures (const struct GNUNET_PQ_QueryParam *params) |
Must be called to cleanup memory from closures after the query parameters have been used as much as needed. More... | |
void | GNUNET_PQ_cleanup_result (struct GNUNET_PQ_ResultSpec *rs) |
Free all memory that was allocated in rs during GNUNET_PQ_extract_result(). More... | |
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. More... | |
helper functions for libpq (PostGres) interactions
Definition in file pq.c.
PGresult * GNUNET_PQ_exec_prepared | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
const struct GNUNET_PQ_QueryParam * | params | ||
) |
Execute a prepared statement.
db | database context |
name | name of the prepared statement |
params | parameters to the statement |
Definition at line 33 of file pq.c.
References GNUNET_PQ_QueryParam::conv, GNUNET_PQ_QueryParam::conv_cls, GNUNET_PQ_QueryParam::data, db, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_log_from, GNUNET_NZL, GNUNET_PQ_reconnect(), name, GNUNET_PQ_QueryParam::num_params, res, ret, GNUNET_PQ_QueryParam::size, and status.
Referenced by GNUNET_PQ_eval_prepared_multi_select(), GNUNET_PQ_eval_prepared_non_select(), and GNUNET_PQ_eval_prepared_singleton_select().
void GNUNET_PQ_cleanup_query_params_closures | ( | const struct GNUNET_PQ_QueryParam * | params | ) |
Must be called to cleanup memory from closures after the query parameters have been used as much as needed.
params | Array of GNUNET_PQ_QueryParam which must terminate with a GNUNET_PQ_query_param_end |
Definition at line 123 of file pq.c.
References GNUNET_PQ_QueryParam::conv_cls, GNUNET_PQ_QueryParam::conv_cls_cleanup, and GNUNET_PQ_QueryParam::num_params.
void GNUNET_PQ_cleanup_result | ( | struct GNUNET_PQ_ResultSpec * | rs | ) |
Free all memory that was allocated in rs during GNUNET_PQ_extract_result().
rs | reult specification to clean up |
Definition at line 139 of file pq.c.
References GNUNET_PQ_ResultSpec::cleaner, and GNUNET_PQ_ResultSpec::conv.
Referenced by check_patch_applied(), extract_result_cb(), handle_results(), namecache_postgres_lookup_block(), parse_result_call_iterator(), postgres_plugin_del(), process_keys(), and process_result().
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.
result | result to process | |
[in,out] | rs | result specification to extract for |
row | row from the result to extract |
Definition at line 149 of file pq.c.
References GNUNET_PQ_ResultSpec::cleaner, cleanup(), GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::conv, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_PQ_ResultSpec::is_null, GNUNET_PQ_ResultSpec::is_nullable, result, GNUNET_PQ_ResultSpec::result_size, and ret.
Referenced by extract_result_cb(), GNUNET_PQ_eval_prepared_singleton_select(), handle_results(), parse_result_call_iterator(), process_keys(), and process_result().