![]() |
GNUnet
0.11.x
|
functions to extract result values More...
Go to the source code of this file.
Functions | |
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. More... | |
static void | clean_varsize_blob (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
static int | extract_varsize_blob (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_variable_size (const char *name, void **dst, size_t *sptr) |
Variable-size result expected. More... | |
static int | extract_fixed_blob (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_fixed_size (const char *name, void *dst, size_t dst_size) |
Fixed-size result expected. More... | |
static int | extract_rsa_public_key (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. More... | |
static void | clean_rsa_public_key (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_rsa_public_key (const char *name, struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
RSA public key expected. More... | |
static int | extract_rsa_signature (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. More... | |
static void | clean_rsa_signature (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_rsa_signature (const char *name, struct GNUNET_CRYPTO_RsaSignature **sig) |
RSA signature expected. More... | |
static int | extract_string (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. More... | |
static void | clean_string (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_string (const char *name, char **dst) |
0-terminated string expected. More... | |
static int | extract_rel_time (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_relative_time (const char *name, struct GNUNET_TIME_Relative *rt) |
Relative time expected. More... | |
static int | extract_abs_time (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_absolute_time (const char *name, struct GNUNET_TIME_Absolute *at) |
Absolute time expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_absolute_time_nbo (const char *name, struct GNUNET_TIME_AbsoluteNBO *at) |
Absolute time expected. More... | |
static int | extract_uint16 (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint16 (const char *name, uint16_t *u16) |
uint16_t expected. More... | |
static int | extract_uint32 (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint32 (const char *name, uint32_t *u32) |
uint32_t expected. More... | |
static int | extract_uint64 (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. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint64 (const char *name, uint64_t *u64) |
uint64_t expected. More... | |
functions to extract result values
Definition in file pq_result_helper.c.
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.
rs | result spec entry to modify | |
[out] | is_null | location set to 'true' if the value was indeed NULL, set to 'false' if the value was non-NULL |
Definition at line 31 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::is_null, and GNUNET_PQ_ResultSpec::is_nullable.
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 51 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, and GNUNET_free.
Referenced by GNUNET_PQ_result_spec_variable_size().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 79 of file pq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, len, and res.
Referenced by GNUNET_PQ_result_spec_variable_size().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_variable_size | ( | const char * | name, |
void ** | dst, | ||
size_t * | sptr | ||
) |
Variable-size result expected.
name | name of the field in the table | |
[out] | dst | where to store the result, allocated |
[out] | sptr | where to store the size of dst |
Definition at line 129 of file pq_result_helper.c.
References clean_varsize_blob(), GNUNET_PQ_ResultSpec::dst, extract_varsize_blob(), name, and res.
Referenced by extract_result_cb(), handle_results(), namecache_postgres_lookup_block(), parse_result_call_iterator(), postgres_plugin_get_random(), and process_result().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in] | dst_size | desired size, never NULL |
[out] | dst | where to store the result |
Definition at line 156 of file pq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, len, and res.
Referenced by GNUNET_PQ_result_spec_fixed_size().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_fixed_size | ( | const char * | name, |
void * | dst, | ||
size_t | dst_size | ||
) |
Fixed-size result expected.
name | name of the field in the table | |
[out] | dst | where to store the result |
dst_size | number of bytes in dst |
Definition at line 213 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, extract_fixed_blob(), and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 240 of file pq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_OK, GNUNET_SYSERR, len, pk, and res.
Referenced by GNUNET_PQ_result_spec_rsa_public_key().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 295 of file pq_result_helper.c.
References GNUNET_CRYPTO_rsa_public_key_free(), and pk.
Referenced by GNUNET_PQ_result_spec_rsa_public_key().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_public_key | ( | const char * | name, |
struct GNUNET_CRYPTO_RsaPublicKey ** | rsa | ||
) |
RSA public key expected.
name | name of the field in the table | |
[out] | rsa | where to store the result |
Definition at line 310 of file pq_result_helper.c.
References clean_rsa_public_key(), extract_rsa_public_key(), and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 337 of file pq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_signature_decode(), GNUNET_OK, GNUNET_SYSERR, len, and res.
Referenced by GNUNET_PQ_result_spec_rsa_signature().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 392 of file pq_result_helper.c.
References GNUNET_CRYPTO_rsa_signature_free().
Referenced by GNUNET_PQ_result_spec_rsa_signature().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_signature | ( | const char * | name, |
struct GNUNET_CRYPTO_RsaSignature ** | sig | ||
) |
RSA signature expected.
name | name of the field in the table | |
[out] | sig | where to store the result; |
Definition at line 407 of file pq_result_helper.c.
References clean_rsa_signature(), extract_rsa_signature(), and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 434 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_break, GNUNET_OK, GNUNET_strndup, GNUNET_SYSERR, len, and res.
Referenced by GNUNET_PQ_result_spec_string().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 489 of file pq_result_helper.c.
References GNUNET_free.
Referenced by GNUNET_PQ_result_spec_string().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_string | ( | const char * | name, |
char ** | dst | ||
) |
0-terminated string expected.
name | name of the field in the table | |
[out] | dst | where to store the result, allocated |
Definition at line 504 of file pq_result_helper.c.
References clean_string(), GNUNET_PQ_ResultSpec::dst, extract_string(), and res.
Referenced by GNUNET_PQ_run_sql(), and parse_result_call_iterator().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 531 of file pq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_Relative::rel_value_us, and res.
Referenced by GNUNET_PQ_result_spec_relative_time().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_relative_time | ( | const char * | name, |
struct GNUNET_TIME_Relative * | rt | ||
) |
Relative time expected.
name | name of the field in the table | |
[out] | rt | where to store the result |
Definition at line 583 of file pq_result_helper.c.
References extract_rel_time(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 614 of file pq_result_helper.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_assert, GNUNET_break, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, and res.
Referenced by GNUNET_PQ_result_spec_absolute_time().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time | ( | const char * | name, |
struct GNUNET_TIME_Absolute * | at | ||
) |
Absolute time expected.
name | name of the field in the table | |
[out] | at | where to store the result |
Definition at line 666 of file pq_result_helper.c.
References extract_abs_time(), name, and res.
Referenced by extract_result_cb(), handle_results(), postgres_plugin_get_random(), and process_result().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time_nbo | ( | const char * | name, |
struct GNUNET_TIME_AbsoluteNBO * | at | ||
) |
Absolute time expected.
name | name of the field in the table | |
[out] | at | where to store the result |
Definition at line 680 of file pq_result_helper.c.
References GNUNET_PQ_result_spec_auto_from_type, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 704 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, and res.
Referenced by GNUNET_PQ_result_spec_uint16().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint16 | ( | const char * | name, |
uint16_t * | u16 | ||
) |
uint16_t expected.
name | name of the field in the table | |
[out] | u16 | where to store the result |
Definition at line 753 of file pq_result_helper.c.
References extract_uint16(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 780 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, and res.
Referenced by GNUNET_PQ_result_spec_uint32().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint32 | ( | const char * | name, |
uint32_t * | u32 | ||
) |
uint32_t expected.
name | name of the field in the table | |
[out] | u32 | where to store the result |
Definition at line 829 of file pq_result_helper.c.
References extract_uint32(), name, and res.
Referenced by extract_result_cb(), handle_results(), parse_result_call_iterator(), postgres_plugin_del(), postgres_plugin_get_random(), and process_result().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
int | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 856 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, and res.
Referenced by GNUNET_PQ_result_spec_uint64().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint64 | ( | const char * | name, |
uint64_t * | u64 | ||
) |
uint64_t expected.
name | name of the field in the table | |
[out] | u64 | where to store the result |
Definition at line 908 of file pq_result_helper.c.
References extract_uint64(), name, and res.
Referenced by parse_result_call_iterator(), and postgres_plugin_estimate_size().