#ifndef GNUNET_SQ_LIB_H
#define GNUNET_SQ_LIB_H
-#include <sqlite/sqlite3.h>
+#include <sqlite3.h>
#include "gnunet_util_lib.h"
*
* @param cls closure
* @param result where to extract data from
- * @param int row to extract data from
+ * @param column column to extract data from
* @param[in,out] dst_size where to store size of result, may be NULL
* @param[out] dst where to store the result
* @return
typedef int
(*GNUNET_SQ_ResultConverter)(void *cls,
sqlite3_stmt *result,
- int row,
+ unsigned int column,
size_t *dst_size,
void *dst);
+/**
+ * @brief Description of a DB result cell.
+ */
+struct GNUNET_SQ_ResultSpec;
+
+
/**
* Function called to clean up memory allocated
* by a #GNUNET_SQ_ResultConverter.
*
* @param cls closure
- * @param rd result data to clean up
*/
typedef void
-(*GNUNET_SQ_ResultCleanup)(void *cls,
- void *rd);
+(*GNUNET_SQ_ResultCleanup)(void *cls);
/**
size_t dst_size;
/**
- * Where to store actual size of the result.
+ * Where to store actual size of the result. If left at
+ * NULL, will be made to point to @e dst_size before
+ * @a conv is called.
*/
size_t *result_size;
+ /**
+ * Number of parameters (columns) eaten by this operation.
+ */
+ unsigned int num_params;
+
};
* @param dst point to where to store the result, type fits expected result size
* @return array entry for the result specification to use
*/
-#define GNUNET_SQ_result_spec_auto_from_type(dst) GNUNET_SQ_result_spec_fixed_size (name, (dst), sizeof (*(dst)))
+#define GNUNET_SQ_result_spec_auto_from_type(dst) GNUNET_SQ_result_spec_fixed_size ((dst), sizeof (*(dst)))
/**
*
* @param result result to process
* @param[in,out] rs result specification to extract for
- * @param row row from the result to extract
* @return
- * #GNUNET_YES if all results could be extracted
+ * #GNUNET_OK if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field)
*/
int
GNUNET_SQ_extract_result (sqlite3_stmt *result,
- struct GNUNET_SQ_ResultSpec *rs,
- int row);
+ struct GNUNET_SQ_ResultSpec *rs);
/**