3 This file is part of GNUnet
4 Copyright (C) 2017 GNUnet e.V.
6 GNUnet is free software; you can redistribute it and/or modify it under the
7 terms of the GNU General Public License as published by the Free Software
8 Foundation; either version 3, or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along with
15 GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
18 * @file sq/sq_result_helper.c
19 * @brief helper functions for queries
20 * @author Christian Grothoff
23 #include "gnunet_sq_lib.h"
27 * Extract fixed-sized binary data from a Postgres database @a result at row @a row.
30 * @param result where to extract data from
31 * @param row row to extract data from
32 * @param column column to extract data from
33 * @param[in,out] dst_size where to store size of result, may be NULL
34 * @param[out] dst where to store the result
36 * #GNUNET_YES if all results could be extracted
37 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
40 extract_fixed_blob (void *cls,
51 * Variable-size result expected.
53 * @param[out] dst where to store the result, allocated
54 * @param[out] sptr where to store the size of @a dst
55 * @return array entry for the result specification to use
57 struct GNUNET_SQ_ResultSpec
58 GNUNET_SQ_result_spec_variable_size (void **dst,
65 * Fixed-size result expected.
67 * @param[out] dst where to store the result
68 * @param dst_size number of bytes in @a dst
69 * @return array entry for the result specification to use
71 struct GNUNET_SQ_ResultSpec
72 GNUNET_SQ_result_spec_fixed_size (void *dst,
79 * 0-terminated string expected.
81 * @param[out] dst where to store the result, allocated
82 * @return array entry for the result specification to use
84 struct GNUNET_SQ_ResultSpec
85 GNUNET_SQ_result_spec_string (char **dst)
91 * RSA public key expected.
93 * @param[out] rsa where to store the result
94 * @return array entry for the result specification to use
96 struct GNUNET_SQ_ResultSpec
97 GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
103 * RSA signature expected.
105 * @param[out] sig where to store the result;
106 * @return array entry for the result specification to use
108 struct GNUNET_SQ_ResultSpec
109 GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
115 * Absolute time expected.
117 * @param[out] at where to store the result
118 * @return array entry for the result specification to use
120 struct GNUNET_SQ_ResultSpec
121 GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
127 * Absolute time expected.
129 * @param[out] at where to store the result
130 * @return array entry for the result specification to use
132 struct GNUNET_SQ_ResultSpec
133 GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
141 * @param[out] u16 where to store the result
142 * @return array entry for the result specification to use
144 struct GNUNET_SQ_ResultSpec
145 GNUNET_SQ_result_spec_uint16 (uint16_t *u16)
153 * @param[out] u32 where to store the result
154 * @return array entry for the result specification to use
156 struct GNUNET_SQ_ResultSpec
157 GNUNET_SQ_result_spec_uint32 (uint32_t *u32)
165 * @param[out] u64 where to store the result
166 * @return array entry for the result specification to use
168 struct GNUNET_SQ_ResultSpec
169 GNUNET_SQ_result_spec_uint64 (uint64_t *u64)
174 /* end of sq_result_helper.c */