diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-27 02:08:21 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-27 02:08:21 +0100 |
commit | 8b3286e953a80cf069271957ec817485ebe5b14e (patch) | |
tree | f8d013d64ad9bb0531e087234894f040f0819f70 /src/include/gnunet_sq_lib.h | |
parent | 34cbc615577b80ad57c706c0001123f3d5cb752d (diff) | |
download | gnunet-8b3286e953a80cf069271957ec817485ebe5b14e.tar.gz gnunet-8b3286e953a80cf069271957ec817485ebe5b14e.zip |
implement sq_query_helper.c
Diffstat (limited to 'src/include/gnunet_sq_lib.h')
-rw-r--r-- | src/include/gnunet_sq_lib.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/include/gnunet_sq_lib.h b/src/include/gnunet_sq_lib.h index a068650ac..1606d1129 100644 --- a/src/include/gnunet_sq_lib.h +++ b/src/include/gnunet_sq_lib.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef GNUNET_SQ_LIB_H | 21 | #ifndef GNUNET_SQ_LIB_H |
22 | #define GNUNET_SQ_LIB_H | 22 | #define GNUNET_SQ_LIB_H |
23 | 23 | ||
24 | #include <sqlite/sqlite3.h> | 24 | #include <sqlite3.h> |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | 26 | ||
27 | 27 | ||
@@ -186,7 +186,8 @@ GNUNET_SQ_query_param_uint64 (const uint64_t *x); | |||
186 | * | 186 | * |
187 | * @param cls closure | 187 | * @param cls closure |
188 | * @param result where to extract data from | 188 | * @param result where to extract data from |
189 | * @param int row to extract data from | 189 | * @param row row to extract data from |
190 | * @param column column to extract data from | ||
190 | * @param[in,out] dst_size where to store size of result, may be NULL | 191 | * @param[in,out] dst_size where to store size of result, may be NULL |
191 | * @param[out] dst where to store the result | 192 | * @param[out] dst where to store the result |
192 | * @return | 193 | * @return |
@@ -197,20 +198,25 @@ typedef int | |||
197 | (*GNUNET_SQ_ResultConverter)(void *cls, | 198 | (*GNUNET_SQ_ResultConverter)(void *cls, |
198 | sqlite3_stmt *result, | 199 | sqlite3_stmt *result, |
199 | int row, | 200 | int row, |
201 | unsigned int column, | ||
200 | size_t *dst_size, | 202 | size_t *dst_size, |
201 | void *dst); | 203 | void *dst); |
202 | 204 | ||
203 | 205 | ||
204 | /** | 206 | /** |
207 | * @brief Description of a DB result cell. | ||
208 | */ | ||
209 | struct GNUNET_SQ_ResultSpec; | ||
210 | |||
211 | |||
212 | /** | ||
205 | * Function called to clean up memory allocated | 213 | * Function called to clean up memory allocated |
206 | * by a #GNUNET_SQ_ResultConverter. | 214 | * by a #GNUNET_SQ_ResultConverter. |
207 | * | 215 | * |
208 | * @param cls closure | 216 | * @param cls closure |
209 | * @param rd result data to clean up | ||
210 | */ | 217 | */ |
211 | typedef void | 218 | typedef void |
212 | (*GNUNET_SQ_ResultCleanup)(void *cls, | 219 | (*GNUNET_SQ_ResultCleanup)(void *cls); |
213 | void *rd); | ||
214 | 220 | ||
215 | 221 | ||
216 | /** | 222 | /** |
@@ -252,6 +258,11 @@ struct GNUNET_SQ_ResultSpec | |||
252 | */ | 258 | */ |
253 | size_t *result_size; | 259 | size_t *result_size; |
254 | 260 | ||
261 | /** | ||
262 | * Number of parameters (columns) eaten by this operation. | ||
263 | */ | ||
264 | unsigned int num_params; | ||
265 | |||
255 | }; | 266 | }; |
256 | 267 | ||
257 | 268 | ||
@@ -407,7 +418,7 @@ GNUNET_SQ_bind (sqlite3_stmt *stmt, | |||
407 | * @param[in,out] rs result specification to extract for | 418 | * @param[in,out] rs result specification to extract for |
408 | * @param row row from the result to extract | 419 | * @param row row from the result to extract |
409 | * @return | 420 | * @return |
410 | * #GNUNET_YES if all results could be extracted | 421 | * #GNUNET_OK if all results could be extracted |
411 | * #GNUNET_SYSERR if a result was invalid (non-existing field) | 422 | * #GNUNET_SYSERR if a result was invalid (non-existing field) |
412 | */ | 423 | */ |
413 | int | 424 | int |