From 1732154b8c021e7ee0e34c28cf3b1a843454727a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 21 Jun 2016 13:17:16 +0000 Subject: [PATCH] towards fixing mysql plugin --- src/Makefile.am | 12 +-- src/datastore/plugin_datastore_mysql.c | 120 +++++++++++-------------- src/include/gnunet_my_lib.h | 40 +++++---- src/include/gnunet_mysql_lib.h | 16 +--- src/my/my.c | 9 +- src/mysql/mysql.c | 48 +++++----- 6 files changed, 114 insertions(+), 131 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5582c178b..24c2f583a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -70,7 +70,7 @@ SUBDIRS = \ util \ $(JSON_DIR) \ $(REST_DIR) \ - $(JSONAPI_DIR) \ + $(JSONAPI_DIR) \ hello \ tun \ block \ @@ -97,19 +97,19 @@ SUBDIRS = \ hostlist \ topology \ regex \ - cadet \ dns \ identity \ - set \ - scalarproduct \ - revocation \ gnsrecord \ namecache \ namestore \ + peerstore \ + cadet \ + set \ + scalarproduct \ + revocation \ vpn \ gns \ $(CONVERSATION_DIR) \ - peerstore \ fs \ exit \ pt \ diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 4b0479a7f..3bfdf004f 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -250,9 +250,12 @@ do_delete_entry (struct Plugin *plugin, unsigned long long uid) 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,18 +291,18 @@ mysql_plugin_estimate_size (void *cls, unsigned long long *estimate) 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)) { *estimate = (unsigned long long)total; } } - //*estimate = total; else *estimate = 0; @@ -339,7 +342,7 @@ mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, (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 @@ mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 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 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt 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 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt 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 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt (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 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * 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 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * 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 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * 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 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * */ 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 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * 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 @@ repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size, { struct ReplCtx *rc = cls; struct Plugin *plugin = rc->plugin; - unsigned long long oid; int ret; int iret; @@ -882,18 +876,13 @@ repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 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 @@ mysql_plugin_get_replication (void *cls, PluginDatumProcessor proc, 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_plugin_get_keys (void *cls, // 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 @@ mysql_plugin_get_keys (void *cls, 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_plugin_get_keys (void *cls, 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, diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h index e2ccee039..61fd6459f 100644 --- a/src/include/gnunet_my_lib.h +++ b/src/include/gnunet_my_lib.h @@ -359,32 +359,34 @@ GNUNET_MY_query_param_uint64 (const uint64_t *x); #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); diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h index dfa173cf9..fc0bfdfac 100644 --- a/src/include/gnunet_mysql_lib.h +++ b/src/include/gnunet_mysql_lib.h @@ -104,13 +104,11 @@ GNUNET_MYSQL_statements_invalidate (struct GNUNET_MYSQL_Context *mc); * 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 @@ GNUNET_MYSQL_statement_run (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ GNUNET_MYSQL_statement_run (struct GNUNET_MYSQL_Context *mc, * 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 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, * 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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, * 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, ...); diff --git a/src/my/my.c b/src/my/my.c index 5ef2f18cf..ae46a2888 100644 --- a/src/my/my.c +++ b/src/my/my.c @@ -55,7 +55,7 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, MYSQL_BIND qbind[num]; unsigned int off; - memset(qbind, 0, sizeof(qbind)); + memset (qbind, 0, sizeof(qbind)); off = 0; for (i=0;NULL != (p = ¶ms[i])->conv;i++) { @@ -71,7 +71,7 @@ GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, } 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 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, 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 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, __FILE__, __LINE__, mysql_stmt_error (stmt)); GNUNET_MY_cleanup_result (rs); + mysql_stmt_free_result (stmt); return GNUNET_SYSERR; } field_off = 0; @@ -227,12 +228,14 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, 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; } field_off += rp->num_fields; } } + mysql_stmt_free_result (stmt); return GNUNET_OK; } diff --git a/src/mysql/mysql.c b/src/mysql/mysql.c index ae77de9a7..7042d662e 100644 --- a/src/mysql/mysql.c +++ b/src/mysql/mysql.c @@ -103,6 +103,11 @@ struct GNUNET_MYSQL_StatementHandle */ struct GNUNET_MYSQL_StatementHandle *prev; + /** + * Mysql Context the statement handle belongs to. + */ + struct GNUNET_MYSQL_Context *mc; + /** * Original query string. */ @@ -366,6 +371,7 @@ GNUNET_MYSQL_statement_prepare (struct GNUNET_MYSQL_Context *mc, 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 @@ GNUNET_MYSQL_statement_run (struct GNUNET_MYSQL_Context *mc, const char *sql) * @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 @@ prepare_statement (struct GNUNET_MYSQL_Context *mc, * 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 @@ GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_Context * mc, * 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 @@ init_params (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ init_params (struct GNUNET_MYSQL_Context *mc, * 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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, 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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, _("`%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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, _("`%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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, * 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 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, 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 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, /** * 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 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, * 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; -- 2.25.1