}
+/**
+ * Function called to convert input argument into SQL parameters.
+ *
+ * @param cls closure
+ * @param pq data about the query
+ * @param qbind array of parameters to initialize
+ * @return -1 on error
+ */
+static int
+my_conv_string (void *cls,
+ const struct GNUNET_MY_QueryParam *qp,
+ MYSQL_BIND *qbind)
+{
+ GNUNET_assert (1 == qp->num_params);
+
+ qbind->buffer = (void *) qp->data;
+ qbind->buffer_length = qp->data_len;
+ qbind->buffer_type = MYSQL_TYPE_STRING;
+
+ return 1;
+}
+
+
/**
* Generate query parameter for a string
*
struct GNUNET_MY_QueryParam
GNUNET_MY_query_param_string (const char *ptr)
{
- return GNUNET_MY_query_param_fixed_size (ptr,
- strlen(ptr));
+ struct GNUNET_MY_QueryParam qp = {
+ .conv = &my_conv_string,
+ .cleaner = NULL,
+ .conv_cls = NULL,
+ .num_params = 1,
+ .data = ptr,
+ .data_len = strlen (ptr)
+ };
+ return qp;
}
*/
static void
regex_iterator (void *cls,
- const struct GNUNET_HashCode *key,
- const char *proof,
+ const struct GNUNET_HashCode *key,
+ const char *proof,
int accepting,
- unsigned int num_edges,
+ unsigned int num_edges,
const struct REGEX_BLOCK_Edge *edges)
{
unsigned int i;
{
struct GNUNET_MY_QueryParam params_select[] = {
GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_fixed_size(edges[i].label, strlen (edges[i].label)),
+ GNUNET_MY_query_param_string (edges[i].label),
GNUNET_MY_query_param_end
};
if (-1 != total && total > 0)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Total: %llu (%s, %s)\n", (unsigned long long)total,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Total: %llu (%s, %s)\n",
+ (unsigned long long)total,
GNUNET_h2s (key), edges[i].label);
}
struct GNUNET_MY_QueryParam params_stmt[] = {
GNUNET_MY_query_param_auto_from_type (&key),
- GNUNET_MY_query_param_fixed_size (edges[i].label, strlen (edges[i].label)),
+ GNUNET_MY_query_param_string (edges[i].label),
GNUNET_MY_query_param_auto_from_type (&edges[i].destination),
GNUNET_MY_query_param_uint32 (&iaccepting),
GNUNET_MY_query_param_end
char *key_str = GNUNET_strdup (GNUNET_h2s (key));
char *to_key_str = GNUNET_strdup (GNUNET_h2s (&edges[i].destination));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Merged (%s, %s, %s, %i)\n", key_str,
- edges[i].label, to_key_str, accepting);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Merged (%s, %s, %s, %i)\n",
+ key_str,
+ edges[i].label,
+ to_key_str,
+ accepting);
+
GNUNET_free (key_str);
GNUNET_free (to_key_str);
num_merged_transitions++;
{
struct GNUNET_MY_QueryParam params_stmt[] = {
GNUNET_MY_query_param_auto_from_type (key),
- GNUNET_MY_query_param_fixed_size (NULL, 0),
+ GNUNET_MY_query_param_string (""),
GNUNET_MY_query_param_auto_from_type (NULL),
GNUNET_MY_query_param_uint32 (&iaccepting),
GNUNET_MY_query_param_end