helper functions for queries More...
Go to the source code of this file.
Functions | |
static int | extract_var_blob (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract variable-sized binary data from a Postgres database result at row row. More... | |
static void | clean_var_blob (void *cls) |
Cleanup memory allocated by extract_var_blob(). More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_variable_size (void **dst, size_t *sptr) |
Variable-size result expected. More... | |
static int | extract_fixed_blob (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract fixed-sized binary data from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_fixed_size (void *dst, size_t dst_size) |
Fixed-size result expected. More... | |
static int | extract_utf8_string (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract fixed-sized binary data from a Postgres database result at row row. More... | |
static void | clean_utf8_string (void *cls) |
Cleanup memory allocated by extract_var_blob(). More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_string (char **dst) |
0-terminated string expected. More... | |
static int | extract_rsa_pub (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_rsa_pub (void *cls) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
RSA public key expected. More... | |
static int | extract_rsa_sig (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_rsa_sig (void *cls) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig) |
RSA signature expected. More... | |
static int | extract_abs_time (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract absolute time value from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at) |
Absolute time expected. More... | |
static int | extract_abs_time_nbo (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract absolute time value in NBO from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at) |
Absolute time expected. More... | |
static int | extract_uint16 (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract 16-bit integer from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint16 (uint16_t *u16) |
uint16_t expected. More... | |
static int | extract_uint32 (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract 32-bit integer from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint32 (uint32_t *u32) |
uint32_t expected. More... | |
static int | extract_uint64 (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst) |
Extract 64-bit integer from a Postgres database result at row row. More... | |
struct GNUNET_SQ_ResultSpec | GNUNET_SQ_result_spec_uint64 (uint64_t *u64) |
uint64_t expected. More... | |
helper functions for queries
Definition in file sq_result_helper.c.
|
static |
Extract variable-sized binary data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result (actually a void ** ) |
Definition at line 42 of file sq_result_helper.c.
References GNUNET_break, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, result, and ret.
Referenced by GNUNET_SQ_result_spec_variable_size().
|
static |
Cleanup memory allocated by extract_var_blob().
cls | pointer to pointer of allocation |
Definition at line 99 of file sq_result_helper.c.
References GNUNET_free.
Referenced by GNUNET_SQ_result_spec_variable_size().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_variable_size | ( | void ** | dst, |
size_t * | sptr | ||
) |
Variable-size result expected.
[out] | dst | where to store the result, allocated |
[out] | sptr | where to store the size of dst |
Definition at line 119 of file sq_result_helper.c.
References clean_var_blob(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_var_blob().
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), and sqlite_plugin_get_closest().
|
static |
Extract fixed-sized binary data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 148 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, GNUNET_break, GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, result, and ret.
Referenced by GNUNET_SQ_result_spec_fixed_size().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_fixed_size | ( | void * | dst, |
size_t | dst_size | ||
) |
Fixed-size result expected.
[out] | dst | where to store the result |
dst_size | number of bytes in dst |
Definition at line 198 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, and extract_fixed_blob().
|
static |
Extract fixed-sized binary data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 225 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, GNUNET_break, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, and result.
Referenced by GNUNET_SQ_result_spec_string().
|
static |
Cleanup memory allocated by extract_var_blob().
cls | pointer to pointer of allocation |
Definition at line 269 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::cls, and GNUNET_free.
Referenced by GNUNET_SQ_result_spec_string().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_string | ( | char ** | dst | ) |
0-terminated string expected.
[out] | dst | where to store the result, allocated |
Definition at line 288 of file sq_result_helper.c.
References clean_utf8_string(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_utf8_string().
Referenced by get_records_and_call_iterator(), and peerstore_sqlite_iterate_records().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 315 of file sq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_OK, GNUNET_SYSERR, pk, result, and ret.
Referenced by GNUNET_SQ_result_spec_rsa_public_key().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
Definition at line 362 of file sq_result_helper.c.
References GNUNET_CRYPTO_rsa_public_key_free(), and pk.
Referenced by GNUNET_SQ_result_spec_rsa_public_key().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_public_key | ( | struct GNUNET_CRYPTO_RsaPublicKey ** | rsa | ) |
RSA public key expected.
[out] | rsa | where to store the result |
Definition at line 381 of file sq_result_helper.c.
References clean_rsa_pub(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_pub().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 408 of file sq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_signature_decode(), GNUNET_OK, GNUNET_SYSERR, result, and ret.
Referenced by GNUNET_SQ_result_spec_rsa_signature().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | result data to clean up |
Definition at line 455 of file sq_result_helper.c.
References GNUNET_CRYPTO_rsa_signature_free().
Referenced by GNUNET_SQ_result_spec_rsa_signature().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_signature | ( | struct GNUNET_CRYPTO_RsaSignature ** | sig | ) |
RSA signature expected.
[out] | sig | where to store the result; |
Definition at line 474 of file sq_result_helper.c.
References clean_rsa_sig(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_sig().
|
static |
Extract absolute time value from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 501 of file sq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, result, t, and u.
Referenced by GNUNET_SQ_result_spec_absolute_time().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time | ( | struct GNUNET_TIME_Absolute * | at | ) |
Absolute time expected.
[out] | at | where to store the result |
Definition at line 534 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, and extract_abs_time().
Referenced by execute_get(), get_any(), get_typed(), peerstore_sqlite_iterate_records(), and sqlite_plugin_get_closest().
|
static |
Extract absolute time value in NBO from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 560 of file sq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_hton(), GNUNET_TIME_UNIT_FOREVER_ABS, result, t, and u.
Referenced by GNUNET_SQ_result_spec_absolute_time_nbo().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time_nbo | ( | struct GNUNET_TIME_AbsoluteNBO * | at | ) |
Absolute time expected.
[out] | at | where to store the result |
Definition at line 593 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, and extract_abs_time_nbo().
|
static |
Extract 16-bit integer from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 619 of file sq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, result, and u.
Referenced by GNUNET_SQ_result_spec_uint16().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint16 | ( | uint16_t * | u16 | ) |
uint16_t expected.
[out] | u16 | where to store the result |
Definition at line 655 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint16(), and GNUNET_SQ_ResultSpec::num_params.
|
static |
Extract 32-bit integer from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 681 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, result, and u.
Referenced by GNUNET_SQ_result_spec_uint32().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint32 | ( | uint32_t * | u32 | ) |
uint32_t expected.
[out] | u32 | where to store the result |
Definition at line 717 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint32(), and GNUNET_SQ_ResultSpec::num_params.
Referenced by execute_get(), get_any(), get_records_and_call_iterator(), get_typed(), and sqlite_plugin_get_closest().
|
static |
Extract 64-bit integer from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
column | column to extract data from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 743 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, result, and u.
Referenced by GNUNET_SQ_result_spec_uint64().
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint64 | ( | uint64_t * | u64 | ) |
uint64_t expected.
[out] | u64 | where to store the result |
Definition at line 772 of file sq_result_helper.c.
References GNUNET_SQ_ResultSpec::conv, extract_uint64(), and GNUNET_SQ_ResultSpec::num_params.
Referenced by execute_get(), get_records_and_call_iterator(), peerstore_sqlite_iterate_records(), and sqlite_plugin_del().