GNUnet  0.10.x
gnunet_mysql_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
30 #ifndef GNUNET_MYSQL_LIB_H
31 #define GNUNET_MYSQL_LIB_H
32 
33 #include "gnunet_util_lib.h"
34 #include <mysql/mysql.h>
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #if 0 /* keep Emacsens' auto-indent happy */
40 }
41 #endif
42 #endif
43 
44 
49 
50 
55 
56 
66 typedef int
68  unsigned int num_values,
69  MYSQL_BIND * values);
70 
71 
79 struct GNUNET_MYSQL_Context *
81  const char *section);
82 
83 
89 void
91 
92 
100 void
102 
103 
112 MYSQL_STMT *
114 
115 
126  const char *query);
127 
128 
137 int
139  const char *sql);
140 
141 
142 #if 0 /* keep Emacsens' auto-indent happy */
143 {
144 #endif
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif
150  /* end of group */
struct GNUNET_MYSQL_Context * GNUNET_MYSQL_context_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a mysql context.
Definition: mysql.c:331
static struct GNUNET_CONTAINER_MultiHashMap * values
Collection of all values (represented with ValueSet).
char * query
Original query string.
Definition: mysql.c:135
int(* GNUNET_MYSQL_DataProcessor)(void *cls, unsigned int num_values, MYSQL_BIND *values)
Type of a callback that will be called for each data set returned from MySQL.
Handle for a prepared statement.
Definition: mysql.c:114
static unsigned int num_values
static char * section
Name of the section.
Definition: gnunet-config.c:33
void GNUNET_MYSQL_context_destroy(struct GNUNET_MYSQL_Context *mc)
Destroy a mysql context.
Definition: mysql.c:379
static struct SolverHandle * sh
MYSQL_STMT * GNUNET_MYSQL_statement_get_stmt(struct GNUNET_MYSQL_StatementHandle *sh)
Get internal handle for a prepared statement.
Definition: mysql.c:489
void GNUNET_MYSQL_statements_invalidate(struct GNUNET_MYSQL_Context *mc)
Close database connection and all prepared statements (we got a DB error).
Definition: mysql.c:352
static struct GNUNET_TESTBED_Controller * mc
Handle to the master controller.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
Mysql context.
Definition: mysql.c:76
struct GNUNET_MYSQL_StatementHandle * GNUNET_MYSQL_statement_prepare(struct GNUNET_MYSQL_Context *mc, const char *query)
Prepare a statement.
Definition: mysql.c:404
configuration data
Definition: configuration.c:85
int GNUNET_MYSQL_statement_run(struct GNUNET_MYSQL_Context *mc, const char *sql)
Run a SQL statement.
Definition: mysql.c:426