gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37319 - in gnunet/src: . datastore include my mysql


From: gnunet
Subject: [GNUnet-SVN] r37319 - in gnunet/src: . datastore include my mysql
Date: Tue, 21 Jun 2016 15:17:17 +0200

Author: grothoff
Date: 2016-06-21 15:17:16 +0200 (Tue, 21 Jun 2016)
New Revision: 37319

Modified:
   gnunet/src/Makefile.am
   gnunet/src/datastore/plugin_datastore_mysql.c
   gnunet/src/include/gnunet_my_lib.h
   gnunet/src/include/gnunet_mysql_lib.h
   gnunet/src/my/my.c
   gnunet/src/mysql/mysql.c
Log:
towards fixing mysql plugin

Modified: gnunet/src/Makefile.am
===================================================================
--- gnunet/src/Makefile.am      2016-06-21 11:44:29 UTC (rev 37318)
+++ gnunet/src/Makefile.am      2016-06-21 13:17:16 UTC (rev 37319)
@@ -70,7 +70,7 @@
   util \
   $(JSON_DIR) \
   $(REST_DIR) \
-       $(JSONAPI_DIR) \
+  $(JSONAPI_DIR) \
   hello \
   tun \
   block \
@@ -97,19 +97,19 @@
   hostlist \
   topology \
   regex \
-  cadet \
   dns \
   identity \
+  gnsrecord \
+  namecache \
+  namestore \
+  peerstore \
+  cadet \
   set \
   scalarproduct \
   revocation \
-  gnsrecord \
-  namecache \
-  namestore \
   vpn \
   gns \
   $(CONVERSATION_DIR) \
-  peerstore \
   fs \
   exit \
   pt \

Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c       2016-06-21 11:44:29 UTC 
(rev 37318)
+++ gnunet/src/datastore/plugin_datastore_mysql.c       2016-06-21 13:17:16 UTC 
(rev 37319)
@@ -250,9 +250,12 @@
                                  plugin->delete_entry_by_uid,
                                  params_delete);
   if (ret >= 0)
+  {
     return GNUNET_OK;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "Deleting value %llu from gn090 table failed\n", uid);
+              "Deleting value %llu from gn090 table failed\n",
+              uid);
   return ret;
 }
 
@@ -288,11 +291,12 @@
     GNUNET_MY_result_spec_uint64 (&total),
     GNUNET_MY_result_spec_end
   };
+  int ret;
 
 //  if (GNUNET_OK ==
 //      GNUNET_MYSQL_statement_run_prepared_select (plugin->mc, 
plugin->get_size, 1, cbind, NULL, NULL, -1))
-  if (GNUNET_OK == 
-      GNUNET_MY_exec_prepared (plugin->mc, plugin->get_size, params_get))
+  ret = GNUNET_MY_exec_prepared (plugin->mc, plugin->get_size, params_get);
+  if (GNUNET_OK == ret)
     {
       if (GNUNET_OK == GNUNET_MY_extract_result (plugin->get_size, 
results_get))
       {
@@ -299,7 +303,6 @@
         *estimate = (unsigned long long)total;
       }
     }
-
     //*estimate = total;
   else
     *estimate = 0;
@@ -339,7 +342,7 @@
       (unsigned long long) GNUNET_CRYPTO_random_u64 
(GNUNET_CRYPTO_QUALITY_WEAK,
                                                      UINT64_MAX);
 */
-  uint64_t lrvalue =  
+  uint64_t lrvalue =
       (uint64_t) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
                                                      UINT64_MAX);
   unsigned long hashSize;
@@ -387,15 +390,14 @@
     return;
   }
 */
-  if (GNUNET_OK != 
+  if (GNUNET_OK !=
       GNUNET_MY_exec_prepared (plugin->mc,
-                                   plugin->insert_entry,
-                                   params_insert))
+                               plugin->insert_entry,
+                               params_insert))
   {
     cont (cont_cls, key, size, GNUNET_SYSERR, _("MySQL statement run 
failure"));
     return;
   }
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Inserted value `%s' with size %u into gn090 table\n",
               GNUNET_h2s (key), (unsigned int) size);
@@ -494,12 +496,11 @@
   unsigned int anonymity;
 //  unsigned long long exp;
   uint64_t exp;
-  unsigned long hashSize = 0;
   //size_t hashSize;
 //  unsigned long size;
-  uint64_t size;
-  unsigned long long uid = 0;
-  char value[GNUNET_DATASTORE_MAX_VALUE_SIZE];
+  size_t size;
+  uint64_t uid;
+  void *value;
   struct GNUNET_HashCode key;
   struct GNUNET_TIME_Absolute expiration;
 //  MYSQL_BIND rbind[7];
@@ -541,9 +542,8 @@
     GNUNET_MY_result_spec_uint32 (&anonymity),
     GNUNET_MY_result_spec_uint64 (&exp),
     GNUNET_MY_result_spec_auto_from_type (&key),
-//    GNUNET_MY_result_spec_variable_size (&key, &hashSize),
-    GNUNET_MY_result_spec_fixed_size (value, sizeof (value)),
-    GNUNET_MY_result_spec_uint64 (&size),
+    GNUNET_MY_result_spec_variable_size (&value, &size),
+    GNUNET_MY_result_spec_uint64 (&uid),
     GNUNET_MY_query_param_end
   };
 
@@ -570,12 +570,6 @@
       (hashSize != sizeof (struct GNUNET_HashCode)))
   {
 */
-  if (hashSize != sizeof (struct GNUNET_HashCode))
-  { 
-    GNUNET_break (0);
-    proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
-    return;
-  }
   expiration.abs_value_us = exp;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Found %u-byte value under key `%s' with prio %u, anon %u, 
expire %s selecting from gn090 table\n",
@@ -662,17 +656,16 @@
         GNUNET_MY_query_param_fixed_size (key, hashSize),
         GNUNET_MY_query_param_fixed_size (vhash, hashSize2),
         GNUNET_MY_query_param_uint32 (&type),
-        GNUNET_MY_query_param_end    
+        GNUNET_MY_query_param_end
       };
 
-      ret = 
-  GNUNET_MY_exec_prepared (plugin->mc,
-                           plugin->count_entry_by_hash_vhash_and_type,
-                           params_get);
-        ret = 
-  GNUNET_MY_extract_result (plugin->count_entry_by_hash_vhash_and_type,
-                            results_get);
-
+      ret =
+        GNUNET_MY_exec_prepared (plugin->mc,
+                                 plugin->count_entry_by_hash_vhash_and_type,
+                                 params_get);
+      ret =
+        GNUNET_MY_extract_result (plugin->count_entry_by_hash_vhash_and_type,
+                                  results_get);
     }
     else
     {
@@ -686,17 +679,17 @@
         struct GNUNET_MY_QueryParam params_get[] = {
           GNUNET_MY_query_param_fixed_size (key, hashSize),
           GNUNET_MY_query_param_uint32 (&type),
-          GNUNET_MY_query_param_end    
+          GNUNET_MY_query_param_end
         };
 
 
-        ret = 
-  GNUNET_MY_exec_prepared (plugin->mc,
-                           plugin->count_entry_by_hash_and_type,
-                           params_get);
-        ret = 
-  GNUNET_MY_extract_result (plugin->count_entry_by_hash_vhash_and_type,
-                            results_get);
+        ret =
+          GNUNET_MY_exec_prepared (plugin->mc,
+                                   plugin->count_entry_by_hash_and_type,
+                                   params_get);
+        ret =
+          GNUNET_MY_extract_result (plugin->count_entry_by_hash_and_type,
+                                    results_get);
     }
   }
   else
@@ -713,16 +706,16 @@
          struct GNUNET_MY_QueryParam params_get[] = {
           GNUNET_MY_query_param_fixed_size (key, hashSize),
           GNUNET_MY_query_param_fixed_size (vhash, hashSize2),
-          GNUNET_MY_query_param_end    
+          GNUNET_MY_query_param_end
         };
 
 
-        ret = 
+        ret =
   GNUNET_MY_exec_prepared (plugin->mc,
-                           plugin->count_entry_by_hash_and_type,
+                           plugin->count_entry_by_hash_and_vhash,
                            params_get);
-        ret = 
-  GNUNET_MY_extract_result (plugin->count_entry_by_hash_vhash_and_type,
+        ret =
+  GNUNET_MY_extract_result (plugin->count_entry_by_hash_and_vhash,
                             results_get);
     }
     else
@@ -734,16 +727,16 @@
 */
         struct GNUNET_MY_QueryParam params_get[] = {
           GNUNET_MY_query_param_fixed_size (key, hashSize),
-          GNUNET_MY_query_param_end    
+          GNUNET_MY_query_param_end
         };
 
 
-        ret = 
+        ret =
   GNUNET_MY_exec_prepared (plugin->mc,
-                           plugin->count_entry_by_hash_and_type,
+                           plugin->count_entry_by_hash,
                            params_get);
-        ret = 
-  GNUNET_MY_extract_result (plugin->count_entry_by_hash_vhash_and_type,
+        ret =
+  GNUNET_MY_extract_result (plugin->count_entry_by_hash,
                             results_get);
     }
 
@@ -756,7 +749,9 @@
   offset = offset % total;
   off = (unsigned long long) offset;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Obtaining %llu/%lld result for GET `%s'\n", off, total,
+              "Obtaining %llu/%lld result for GET `%s'\n",
+              (unsigned long long) off,
+              (unsigned long long) total,
               GNUNET_h2s (key));
   if (type != GNUNET_BLOCK_TYPE_ANY)
   {
@@ -873,7 +868,6 @@
 {
   struct ReplCtx *rc = cls;
   struct Plugin *plugin = rc->plugin;
-  unsigned long long oid;
   int ret;
   int iret;
 
@@ -882,18 +876,13 @@
                 expiration, uid);
   if (NULL != key)
   {
-    oid = (unsigned long long) uid;
-    iret =
-      GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->dec_repl, NULL,
-                                          MYSQL_TYPE_LONGLONG, &oid, 
GNUNET_YES, -1);
-
       struct GNUNET_MY_QueryParam params_proc[] = {
-        GNUNET_MY_query_param_uint64 (&oid),
+        GNUNET_MY_query_param_uint64 (&uid),
         GNUNET_MY_query_param_end
       };
 
-      iret = 
-      GNUNET_MY_exec_prepared (plugin->mc, 
+      iret =
+      GNUNET_MY_exec_prepared (plugin->mc,
                                plugin->dec_repl,
                                params_proc);
     if (iret == GNUNET_SYSERR)
@@ -926,7 +915,7 @@
   struct ReplCtx rc;
   unsigned long long rvalue;
   //unsigned long repl;
-  uint32_t repl; 
+  uint32_t repl;
   MYSQL_BIND results;
 
   rc.plugin = plugin;
@@ -1002,12 +991,11 @@
 //  MYSQL_BIND cbind[1];
 //  unsigned long length;
 
-  statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc,
-                                              plugin->get_all_keys);
+  statement = GNUNET_MYSQL_statement_get_stmt (plugin->get_all_keys);
 
-  
+
   statements_handle_select = GNUNET_MYSQL_statement_prepare (plugin->mc,
-                                              query);
+                                                             query);
 /*
   if (statement == NULL)
   {
@@ -1033,7 +1021,7 @@
 
   struct GNUNET_MY_ResultSpec results_select[] = {
     GNUNET_MY_result_spec_auto_from_type (&key),
-    GNUNET_MY_result_spec_end 
+    GNUNET_MY_result_spec_end
   };
 
   if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc,
@@ -1046,7 +1034,7 @@
                 mysql_stmt_error (statement));
     GNUNET_MYSQL_statements_invalidate (plugin->mc);
     proc (proc_cls, NULL, 0);
-    return; 
+    return;
   }
 
   ret = GNUNET_MY_extract_result (statements_handle_select,

Modified: gnunet/src/include/gnunet_my_lib.h
===================================================================
--- gnunet/src/include/gnunet_my_lib.h  2016-06-21 11:44:29 UTC (rev 37318)
+++ gnunet/src/include/gnunet_my_lib.h  2016-06-21 13:17:16 UTC (rev 37319)
@@ -359,32 +359,34 @@
 #define GNUNET_MY_result_spec_auto_from_type(dst) 
GNUNET_MY_result_spec_fixed_size ((dst), sizeof (*(dst)))
 
 
- /**
-  * Variable-size result expected
-  *
-  * @param[out] dst where to store the result, allocated
-  * @param[out] sptr where to store the size of @a dst
-  * @return array entru for the result specification to use
-  */
+/**
+ * Variable-size result expected
+ *
+ * @param[out] dst where to store the result, allocated
+ * @param[out] sptr where to store the size of @a dst
+ * @return array entru for the result specification to use
+ */
 struct GNUNET_MY_ResultSpec
 GNUNET_MY_result_spec_variable_size (void **dst,
-                                    size_t *ptr_size);
+                                     size_t *ptr_size);
+
 /**
-  * RSA public key expected
-  *
-  * @param name name of the field in the table
-  * @param[out] rsa where to store the result
-  * @return array entry for the result specification to use
-  */
+ * RSA public key expected
+ *
+ * @param name name of the field in the table
+ * @param[out] rsa where to store the result
+ * @return array entry for the result specification to use
+ */
 struct GNUNET_MY_ResultSpec
 GNUNET_MY_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa);
 
+
 /**
-  * RSA signature expected.
-  *
-  * @param[out] sig where to store the result;
-  * @return array entry for the result specification to use
-  */
+ * RSA signature expected.
+ *
+ * @param[out] sig where to store the result;
+ * @return array entry for the result specification to use
+ */
 struct GNUNET_MY_ResultSpec
 GNUNET_MY_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig);
 

Modified: gnunet/src/include/gnunet_mysql_lib.h
===================================================================
--- gnunet/src/include/gnunet_mysql_lib.h       2016-06-21 11:44:29 UTC (rev 
37318)
+++ gnunet/src/include/gnunet_mysql_lib.h       2016-06-21 13:17:16 UTC (rev 
37319)
@@ -104,13 +104,11 @@
  * be used, and if, with caution!  On failures during the interaction with
  * the handle, you must call 'GNUNET_MYSQL_statements_invalidate'!
  *
- * @param mc mysql context
  * @param sh prepared statement to introspect
  * @return MySQL statement handle, NULL on error
  */
 MYSQL_STMT *
-GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_Context *mc,
-                                struct GNUNET_MYSQL_StatementHandle *sh);
+GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_StatementHandle *sh);
 
 
 /**
@@ -142,7 +140,6 @@
 /**
  * Run a prepared SELECT statement.
  *
- * @param mc mysql context
  * @param sh handle to SELECT statment
  * @param result_size number of elements in results array
  * @param results pointer to already initialized MYSQL_BIND
@@ -156,8 +153,7 @@
  *         the number of successfully affected (or queried) rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc,
-                                           struct GNUNET_MYSQL_StatementHandle 
*sh,
+GNUNET_MYSQL_statement_run_prepared_select (struct 
GNUNET_MYSQL_StatementHandle *sh,
                                            unsigned int result_size, 
MYSQL_BIND * results,
                                            GNUNET_MYSQL_DataProcessor 
processor,
                                            void *processor_cls, ...);
@@ -166,7 +162,6 @@
 /**
  * Run a prepared SELECT statement.
  *
- * @param mc mysql context
  * @param s statement to run
  * @param result_size number of elements in results array
  * @param results pointer to already initialized MYSQL_BIND
@@ -180,8 +175,7 @@
  *         the number of successfully affected (or queried) rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc,
-                                              struct 
GNUNET_MYSQL_StatementHandle *s,
+GNUNET_MYSQL_statement_run_prepared_select_va (struct 
GNUNET_MYSQL_StatementHandle *s,
                                               unsigned int result_size,
                                               MYSQL_BIND * results,
                                               GNUNET_MYSQL_DataProcessor 
processor,
@@ -192,7 +186,6 @@
 /**
  * Run a prepared statement that does NOT produce results.
  *
- * @param mc mysql context
  * @param sh handle to statment
  * @param insert_id NULL or address where to store the row ID of whatever
  *        was inserted (only for INSERT statements!)
@@ -203,8 +196,7 @@
  *         the number of successfully affected rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared (struct GNUNET_MYSQL_Context *mc,
-                                    struct GNUNET_MYSQL_StatementHandle *sh,
+GNUNET_MYSQL_statement_run_prepared (struct GNUNET_MYSQL_StatementHandle *sh,
                                     unsigned long long *insert_id, ...);
 
 

Modified: gnunet/src/my/my.c
===================================================================
--- gnunet/src/my/my.c  2016-06-21 11:44:29 UTC (rev 37318)
+++ gnunet/src/my/my.c  2016-06-21 13:17:16 UTC (rev 37319)
@@ -55,7 +55,7 @@
     MYSQL_BIND qbind[num];
     unsigned int off;
 
-    memset(qbind, 0, sizeof(qbind));
+    memset (qbind, 0, sizeof(qbind));
     off = 0;
     for (i=0;NULL != (p = &params[i])->conv;i++)
     {
@@ -71,7 +71,7 @@
       }
       off += p->num_params;
     }
-    stmt = GNUNET_MYSQL_statement_get_stmt (mc, sh);
+    stmt = GNUNET_MYSQL_statement_get_stmt (sh);
     if (mysql_stmt_bind_param (stmt,
                                qbind))
     {
@@ -142,7 +142,7 @@
   int ret;
   MYSQL_STMT *stmt;
 
-  stmt = GNUNET_MYSQL_statement_get_stmt (NULL, sh);
+  stmt = GNUNET_MYSQL_statement_get_stmt (sh);
   if (NULL == stmt)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql",
@@ -209,6 +209,7 @@
                        __FILE__, __LINE__,
                        mysql_stmt_error (stmt));
       GNUNET_MY_cleanup_result (rs);
+      mysql_stmt_free_result (stmt);
       return GNUNET_SYSERR;
     }
     field_off = 0;
@@ -227,6 +228,7 @@
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                       "Post-conversion for MySQL result failed at offset %u\n",
                       i);
+          mysql_stmt_free_result (stmt);
           GNUNET_MY_cleanup_result (rs);
           return GNUNET_SYSERR;
         }
@@ -233,6 +235,7 @@
       field_off += rp->num_fields;
     }
   }
+  mysql_stmt_free_result (stmt);
   return GNUNET_OK;
 }
 

Modified: gnunet/src/mysql/mysql.c
===================================================================
--- gnunet/src/mysql/mysql.c    2016-06-21 11:44:29 UTC (rev 37318)
+++ gnunet/src/mysql/mysql.c    2016-06-21 13:17:16 UTC (rev 37319)
@@ -104,6 +104,11 @@
   struct GNUNET_MYSQL_StatementHandle *prev;
 
   /**
+   * Mysql Context the statement handle belongs to.
+   */
+  struct GNUNET_MYSQL_Context *mc;
+
+  /**
    * Original query string.
    */
   char *query;
@@ -366,6 +371,7 @@
   struct GNUNET_MYSQL_StatementHandle *sh;
 
   sh = GNUNET_new (struct GNUNET_MYSQL_StatementHandle);
+  sh->mc = mc;
   sh->query = GNUNET_strdup (query);
   GNUNET_CONTAINER_DLL_insert (mc->shead, mc->stail, sh);
   return sh;
@@ -404,9 +410,10 @@
  * @return GNUNET_OK on success
  */
 static int
-prepare_statement (struct GNUNET_MYSQL_Context *mc,
-                   struct GNUNET_MYSQL_StatementHandle *sh)
+prepare_statement (struct GNUNET_MYSQL_StatementHandle *sh)
 {
+  struct GNUNET_MYSQL_Context *mc = sh->mc;
+
   if (GNUNET_YES == sh->valid)
     return GNUNET_OK;
   if ((NULL == mc->dbf) && (GNUNET_OK != iopen (mc)))
@@ -435,15 +442,13 @@
  * be used, and if, with caution!  On failures during the interaction with
  * the handle, you must call 'GNUNET_MYSQL_statements_invalidate'!
  *
- * @param mc mysql context
  * @param sh prepared statement to introspect
  * @return MySQL statement handle, NULL on error
  */
 MYSQL_STMT *
-GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_Context * mc,
-                                 struct GNUNET_MYSQL_StatementHandle * sh)
+GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_StatementHandle *sh)
 {
-  (void) prepare_statement (mc, sh);
+  (void) prepare_statement (sh);
   return sh->statement;
 }
 
@@ -452,15 +457,14 @@
  * Bind the parameters for the given MySQL statement
  * and run it.
  *
- * @param mc mysql context
  * @param sh statement to bind and run
  * @param ap arguments for the binding
  * @return GNUNET_SYSERR on error, GNUNET_OK on success
  */
 static int
-init_params (struct GNUNET_MYSQL_Context *mc,
-             struct GNUNET_MYSQL_StatementHandle *sh, va_list ap)
+init_params (struct GNUNET_MYSQL_StatementHandle *sh, va_list ap)
 {
+  struct GNUNET_MYSQL_Context *mc = sh->mc;
   MYSQL_BIND qbind[MAX_PARAM];
   unsigned int pc;
   unsigned int off;
@@ -542,7 +546,6 @@
 /**
  * Run a prepared SELECT statement.
  *
- * @param mc mysql context
  * @param s statement to run
  * @param result_size number of elements in results array
  * @param results pointer to already initialized MYSQL_BIND
@@ -556,8 +559,7 @@
  *         the number of successfully affected (or queried) rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc,
-                                               struct
+GNUNET_MYSQL_statement_run_prepared_select_va (struct
                                                GNUNET_MYSQL_StatementHandle *s,
                                                unsigned int result_size,
                                                MYSQL_BIND * results,
@@ -569,12 +571,12 @@
   unsigned int rsize;
   int total;
 
-  if (GNUNET_OK != prepare_statement (mc, s))
+  if (GNUNET_OK != prepare_statement (s))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-  if (GNUNET_OK != init_params (mc, s, ap))
+  if (GNUNET_OK != init_params (s, ap))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -591,7 +593,7 @@
                 _("`%s' failed at %s:%d with error: %s\n"),
                 "mysql_stmt_bind_result", __FILE__, __LINE__,
                 mysql_stmt_error (s->statement));
-    GNUNET_MYSQL_statements_invalidate (mc);
+    GNUNET_MYSQL_statements_invalidate (s->mc);
     return GNUNET_SYSERR;
   }
 
@@ -607,7 +609,7 @@
                        _("`%s' failed at %s:%d with error: %s\n"),
                        "mysql_stmt_fetch", __FILE__, __LINE__,
                        mysql_stmt_error (s->statement));
-      GNUNET_MYSQL_statements_invalidate (mc);
+      GNUNET_MYSQL_statements_invalidate (s->mc);
       return GNUNET_SYSERR;
     }
     total++;
@@ -623,7 +625,6 @@
 /**
  * Run a prepared SELECT statement.
  *
- * @param mc mysql context
  * @param sh handle to SELECT statment
  * @param result_size number of elements in results array
  * @param results pointer to already initialized MYSQL_BIND
@@ -637,8 +638,7 @@
  *         the number of successfully affected (or queried) rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc,
-                                            struct GNUNET_MYSQL_StatementHandle
+GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_StatementHandle
                                             *sh, unsigned int result_size,
                                             MYSQL_BIND * results,
                                             GNUNET_MYSQL_DataProcessor
@@ -649,7 +649,7 @@
 
   va_start (ap, processor_cls);
   ret =
-      GNUNET_MYSQL_statement_run_prepared_select_va (mc, sh, result_size,
+      GNUNET_MYSQL_statement_run_prepared_select_va (sh, result_size,
                                                      results, processor,
                                                      processor_cls, ap);
   va_end (ap);
@@ -660,7 +660,6 @@
 /**
  * Run a prepared statement that does NOT produce results.
  *
- * @param mc mysql context
  * @param sh handle to statment
  * @param insert_id NULL or address where to store the row ID of whatever
  *        was inserted (only for INSERT statements!)
@@ -671,17 +670,16 @@
  *         the number of successfully affected rows
  */
 int
-GNUNET_MYSQL_statement_run_prepared (struct GNUNET_MYSQL_Context *mc,
-                                     struct GNUNET_MYSQL_StatementHandle *sh,
+GNUNET_MYSQL_statement_run_prepared (struct GNUNET_MYSQL_StatementHandle *sh,
                                      unsigned long long *insert_id, ...)
 {
   va_list ap;
   int affected;
 
-  if (GNUNET_OK != prepare_statement (mc, sh))
+  if (GNUNET_OK != prepare_statement (sh))
     return GNUNET_SYSERR;
   va_start (ap, insert_id);
-  if (GNUNET_OK != init_params (mc, sh, ap))
+  if (GNUNET_OK != init_params (sh, ap))
   {
     va_end (ap);
     return GNUNET_SYSERR;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]