don't run set with valgrind per default
[oweals/gnunet.git] / src / include / gnunet_sq_lib.h
index a068650ac1961fc6aa1e0b582e60bf84ded791a2..c03f83e07b15a504f86509a420c949b84cc99731 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef GNUNET_SQ_LIB_H
 #define GNUNET_SQ_LIB_H
 
-#include <sqlite/sqlite3.h>
+#include <sqlite3.h>
 #include "gnunet_util_lib.h"
 
 
@@ -186,7 +186,7 @@ GNUNET_SQ_query_param_uint64 (const uint64_t *x);
  *
  * @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
@@ -196,21 +196,25 @@ GNUNET_SQ_query_param_uint64 (const uint64_t *x);
 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);
 
 
 /**
@@ -248,10 +252,17 @@ struct GNUNET_SQ_ResultSpec
   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;
+
 };
 
 
@@ -293,7 +304,7 @@ GNUNET_SQ_result_spec_fixed_size (void *dst,
  * @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)))
 
 
 /**
@@ -405,15 +416,13 @@ GNUNET_SQ_bind (sqlite3_stmt *stmt,
  *
  * @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);
 
 
 /**