* </pre>
* and do the following. [You should replace $USER with the username
* that will be running the gnunetd process].
- * <pre>
- *
+ * @verbatim
CREATE DATABASE gnunet;
GRANT select,insert,update,delete,create,alter,drop,create temporary tables
ON gnunet.* TO $USER@localhost;
SET PASSWORD FOR $USER@localhost=PASSWORD('$the_password_you_like');
FLUSH PRIVILEGES;
- *
- * </pre>
+ * @endverbatim
* 2) In the $HOME directory of $USER, create a ".my.cnf" file
* with the following lines
- * <pre>
-
+ * @verbatim
[client]
user=$USER
password=$the_password_you_like
-
- * </pre>
+ * @endverbatim
*
* Thats it -- now you can configure your datastores in GNUnet to
* use MySQL. Note that .my.cnf file is a security risk unless its on
*
* 3) Still, perhaps you should briefly try if the DB connection
* works. First, login as $USER. Then use,
- *
- * <pre>
- * $ mysql -u $USER -p $the_password_you_like
- * mysql> use gnunet;
- * </pre>
+ * @verbatim
+ $ mysql -u $USER -p $the_password_you_like
+ mysql> use gnunet;
+ * @endverbatim
*
* If you get the message "Database changed" it probably works.
*
* "ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock"
* so there may be some additional trouble depending on your mysql setup.]
*
- * REPAIRING TABLES:
- * - Its probably healthy to check your tables for inconsistencies
- * every now and then.
- * - If you get odd SEGVs on gnunetd startup, it might be that the mysql
- * databases have been corrupted.
- * - The tables can be verified/fixed in two ways;
- * 1) by running mysqlcheck -A, or
- * 2) by executing (inside of mysql using the GNUnet database):
- * mysql> SHOW TABLES;
- * mysql> REPAIR TABLE gnXXX;
- *
- * Make sure to replace XXX with the actual names of all tables.
- *
* PROBLEMS?
*
* If you have problems related to the mysql module, your best
/**
* Obtain the location of ".my.cnf".
+ *
+ * @param cfg our configuration
* @return NULL on error
*/
static char *
/**
* Free a prepared statement.
+ *
+ * @param plugin plugin context
+ * @param s prepared statement
*/
static void
prepared_statement_destroy (struct Plugin *plugin,
* Bind the parameters for the given MySQL statement
* and run it.
*
+ * @param plugin plugin context
* @param s statement to bind and run
* @param ap arguments for the binding
* @return GNUNET_SYSERR on error, GNUNET_OK on success
/**
* Run a prepared SELECT statement.
*
+ * @param plugin plugin context
+ * @param s handle to SELECT statment
* @param result_size number of elements in results array
* @param results pointer to already initialized MYSQL_BIND
* array (of sufficient size) for passing results
/**
* Run a prepared statement that does NOT produce results.
*
+ * @param plugin plugin context
+ * @param s handle to SELECT statment
* @param ... pairs and triplets of "MYSQL_TYPE_XXX" keys and their respective
* values (size + buffer-reference for pointers); terminated
* with "-1"
}
+/**
+ * Create temporary table and prepare statements.
+ *
+ * @param plugin plugin context
+ * @return GNUNET_OK on success
+ */
static int
itable (struct Plugin *plugin)
{
* MANUAL SETUP INSTRUCTIONS
*
* 1) in /etc/gnunet.conf, set
- * <pre>
+ * @verbatim
* [datastore]
* DATABASE = "mysql"
- * </pre>
+ * @endverbatim
* 2) Then access mysql as root,
- * <pre>
- *
- * $ mysql -u root -p
- *
- * </pre>
+ * @verbatim
+ $ mysql -u root -p
+ * @endverbatim
* and do the following. [You should replace $USER with the username
* that will be running the gnunetd process].
- * <pre>
- *
+ * @verbatim
CREATE DATABASE gnunet;
GRANT select,insert,update,delete,create,alter,drop,create temporary tables
ON gnunet.* TO $USER@localhost;
SET PASSWORD FOR $USER@localhost=PASSWORD('$the_password_you_like');
FLUSH PRIVILEGES;
- *
- * </pre>
+ * @endverbatim
* 3) In the $HOME directory of $USER, create a ".my.cnf" file
* with the following lines
- * <pre>
-
+ * @verbatim
[client]
user=$USER
password=$the_password_you_like
-
- * </pre>
+ * @endverbatim
*
* Thats it. Note that .my.cnf file is a security risk unless its on
* a safe partition etc. The $HOME/.my.cnf can of course be a symbolic
* 4) Still, perhaps you should briefly try if the DB connection
* works. First, login as $USER. Then use,
*
- * <pre>
- * $ mysql -u $USER -p $the_password_you_like
- * mysql> use gnunet;
- * </pre>
+ * @verbatim
+ $ mysql -u $USER -p $the_password_you_like
+ mysql> use gnunet;
+ * @endverbatim
*
* If you get the message "Database changed" it probably works.
*
* - The tables can be verified/fixed in two ways;
* 1) by running mysqlcheck -A, or
* 2) by executing (inside of mysql using the GNUnet database):
- * mysql> REPAIR TABLE gn090;
- * mysql> REPAIR TABLE gn072;
+ * @verbatim
+ mysql> REPAIR TABLE gn090;
+ mysql> REPAIR TABLE gn072;
+ * @endverbatim
*
* PROBLEMS?
*
/**
* Obtain the location of ".my.cnf".
+ *
+ * @param cfg our configuration
* @return NULL on error
*/
static char *
/**
* Free a prepared statement.
+ *
+ * @param plugin plugin context
+ * @param s prepared statement
*/
static void
prepared_statement_destroy (struct Plugin *plugin,
/**
* Run the given MySQL statement.
*
+ * @param plugin plugin context
+ * @param statement SQL statement to run
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
static int
/**
* Create a prepared statement.
*
+ * @param plugin plugin context
+ * @param statement SQL statement text to prepare
* @return NULL on error
*/
static struct GNUNET_MysqlStatementHandle *
/**
* Prepare a statement for running.
*
+ * @param plugin plugin context
+ * @param ret handle to prepared statement
* @return GNUNET_OK on success
*/
static int
* Bind the parameters for the given MySQL statement
* and run it.
*
+ * @param plugin plugin context
* @param s statement to bind and run
* @param ap arguments for the binding
* @return GNUNET_SYSERR on error, GNUNET_OK on success
/**
* Run a prepared SELECT statement.
*
+ * @param plugin plugin context
+ * @param s statement to run
* @param result_size number of elements in results array
* @param results pointer to already initialized MYSQL_BIND
* array (of sufficient size) for passing results
/**
* Run a prepared statement that does NOT produce results.
*
+ * @param plugin plugin context
+ * @param s statement to run
+ * @param insert_id NULL or address where to store the row ID of whatever
+ * was inserted (only for INSERT statements!)
* @param ... pairs and triplets of "MYSQL_TYPE_XXX" keys and their respective
* values (size + buffer-reference for pointers); terminated
* with "-1"
- * @param insert_id NULL or address where to store the row ID of whatever
- * was inserted (only for INSERT statements!)
* @return GNUNET_SYSERR on error, otherwise
* the number of successfully affected rows
*/
/**
* Delete an value from the gn072 table.
*
+ * @param plugin plugin context
* @param vkey vkey identifying the value to delete
* @return GNUNET_OK on success, GNUNET_NO if no such value exists, GNUNET_SYSERR on error
*/
/**
* Insert a value into the gn072 table.
*
+ * @param plugin plugin context
* @param value the value to insert
* @param size size of the value
* @param vkey vkey identifying the value henceforth (set)
/**
* Delete an entry from the gn090 table.
*
+ * @param plugin plugin context
* @param vkey vkey identifying the entry to delete
* @return GNUNET_OK on success, GNUNET_NO if no such value exists, GNUNET_SYSERR on error
*/
}
+/**
+ * Function that simply returns GNUNET_OK
+ *
+ * @param cls closure, not used
+ * @param num_values not used
+ * @param values not used
+ * @return GNUNET_OK
+ */
static int
return_ok (void *cls,
unsigned int num_values,
}
+/**
+ * FIXME.
+ *
+ * @param cls FIXME
+ * @param ncr FIXME
+ * @return FIXME
+ */
static int
iterator_helper_prepare (void *cls,
struct NextRequestClosure *nrc)
*/
static void
mysql_next_request_cont (void *next_cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct NextRequestClosure *nrc = next_cls;
struct Plugin *plugin;
* using the given query to select and order
* the items.
*
+ * @param plugin plugin context
* @param type entries of which type should be considered?
- * Use 0 for any type.
- * @param iter never NULL
+ * @param iter_select which iterator statement are we using
* @param is_asc are we using ascending order?
+ * @param dviter function to call on each matching item
+ * @param dviter_cls closure for dviter
*/
static void
iterateHelper (struct Plugin *plugin,
- unsigned int type,
+ enum GNUNET_BLOCK_Type type,
int is_asc,
unsigned int iter_select,
PluginIterator dviter,
* Prepare SQL statement.
*
* @param plugin global context
+ * @param name name for the prepared SQL statement
* @param sql SQL code to prepare
* @param nparams number of parameters in sql
* @param line code line for error reporting
*/
static int
pq_prepare (struct Plugin *plugin,
- const char *name, const char *sql, int nparms, int line)
+ const char *name, const char *sql, int nparams, int line)
{
PGresult *ret;
- ret = PQprepare (plugin->dbh, name, sql, nparms, NULL);
+ ret = PQprepare (plugin->dbh, name, sql, nparams, NULL);
if (GNUNET_OK !=
check_result (plugin,
ret, PGRES_COMMAND_OK, "PQprepare", sql, line))
* asking the database plugin to call the iterator
* with the next item.
*
- * @param cls the 'struct NextRequestClosure'
+ * @param next_cls the 'struct NextRequestClosure'
* @param tc scheduler context
*/
static void