* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
* #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ */
static int
extract_varsize_blob (void *cls,
PGresult *result,
const char *res;
void *idst;
int fnum;
-
+
fnum = PQfnumber (result,
fname);
if (fnum < 0)
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
-
+ return GNUNET_SYSERR;
+
/* if a field is null, continue but
* remember that we now return a different result */
len = PQgetlength (result,
{
struct GNUNET_PQ_ResultSpec res =
{ &extract_varsize_blob,
- &clean_varsize_blob, NULL,
+ &clean_varsize_blob, NULL,
(void *) (dst), 0, name, sptr };
return res;
}
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_fixed_blob (void *cls,
PGresult *result,
size_t len;
const char *res;
int fnum;
-
+
fnum = PQfnumber (result,
fname);
if (fnum < 0)
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
-
+ return GNUNET_SYSERR;
+
/* if a field is null, continue but
* remember that we now return a different result */
len = PQgetlength (result,
row,
fnum);
- if (*dst_size != len)
+ if (*dst_size != len)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Field `%s' has wrong size (got %u, expected %u)\n",
{
struct GNUNET_PQ_ResultSpec res =
{ &extract_fixed_blob,
- NULL, NULL,
+ NULL, NULL,
(dst), dst_size, name, NULL };
return res;
}
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_rsa_public_key (void *cls,
PGresult *result,
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
+ return GNUNET_SYSERR;
/* if a field is null, continue but
* remember that we now return a different result */
void *rd)
{
struct GNUNET_CRYPTO_RsaPublicKey **pk = rd;
-
+
if (NULL != *pk)
{
GNUNET_CRYPTO_rsa_public_key_free (*pk);
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_rsa_signature (void *cls,
PGresult *result,
size_t len;
const char *res;
int fnum;
-
+
*sig = NULL;
fnum = PQfnumber (result,
fname);
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
+ return GNUNET_SYSERR;
/* if a field is null, continue but
* remember that we now return a different result */
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_uint16 (void *cls,
PGresult *result,
uint16_t *udst = dst;
const uint16_t *res;
int fnum;
-
+
fnum = PQfnumber (result,
fname);
if (fnum < 0)
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
+ return GNUNET_SYSERR;
GNUNET_assert (NULL != dst);
if (sizeof (uint16_t) != *dst_size)
{
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_uint32 (void *cls,
PGresult *result,
uint32_t *udst = dst;
const uint32_t *res;
int fnum;
-
+
fnum = PQfnumber (result,
fname);
if (fnum < 0)
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
+ return GNUNET_SYSERR;
GNUNET_assert (NULL != dst);
if (sizeof (uint32_t) != *dst_size)
{
uint32_t *u32)
{
struct GNUNET_PQ_ResultSpec res =
- { &extract_uint32,
+ { &extract_uint32,
NULL,
NULL,
(void *) u32, sizeof (*u32), (name), NULL };
* @param[out] dst where to store the result
* @return
* #GNUNET_YES if all results could be extracted
- * #GNUNET_NO if at least one result was NULL
- * #GNUNET_SYSERR if a result was invalid (non-existing field)
- */
+ * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
+ */
static int
extract_uint64 (void *cls,
PGresult *result,
uint64_t *udst = dst;
const uint64_t *res;
int fnum;
-
+
fnum = PQfnumber (result,
fname);
if (fnum < 0)
if (PQgetisnull (result,
row,
fnum))
- return GNUNET_NO;
+ return GNUNET_SYSERR;
GNUNET_assert (NULL != dst);
if (sizeof (uint64_t) != *dst_size)
{