diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-21 14:45:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-21 14:45:19 +0000 |
commit | dde852407a26aa2da817e87acc413fe1f50f81dd (patch) | |
tree | 28d255f66f55b71672552d2d4744fd7942a4e1ac /src/include/gnunet_mysql_lib.h | |
parent | 17c30ef801a526e67a09d761f137dd25ebea5fe7 (diff) | |
download | gnunet-dde852407a26aa2da817e87acc413fe1f50f81dd.tar.gz gnunet-dde852407a26aa2da817e87acc413fe1f50f81dd.zip |
-using new mysql helper library also with datastore
Diffstat (limited to 'src/include/gnunet_mysql_lib.h')
-rw-r--r-- | src/include/gnunet_mysql_lib.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h index 678b7669d..c232a0065 100644 --- a/src/include/gnunet_mysql_lib.h +++ b/src/include/gnunet_mysql_lib.h | |||
@@ -86,6 +86,31 @@ GNUNET_MYSQL_context_destroy (struct GNUNET_MYSQL_Context *mc); | |||
86 | 86 | ||
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Close database connection and all prepared statements (we got a DB | ||
90 | * error). The connection will automatically be re-opened and | ||
91 | * statements will be re-prepared if they are needed again later. | ||
92 | * | ||
93 | * @param mc mysql context | ||
94 | */ | ||
95 | void | ||
96 | GNUNET_MYSQL_statements_invalidate (struct GNUNET_MYSQL_Context *mc); | ||
97 | |||
98 | |||
99 | /** | ||
100 | * Get internal handle for a prepared statement. This function should rarely | ||
101 | * be used, and if, with caution! On failures during the interaction with | ||
102 | * the handle, you must call 'GNUNET_MYSQL_statements_invalidate'! | ||
103 | * | ||
104 | * @param mc mysql context | ||
105 | * @param sh prepared statement to introspect | ||
106 | * @return MySQL statement handle, NULL on error | ||
107 | */ | ||
108 | MYSQL_STMT * | ||
109 | GNUNET_MYSQL_statement_get_stmt (struct GNUNET_MYSQL_Context *mc, | ||
110 | struct GNUNET_MYSQL_StatementHandle *sh); | ||
111 | |||
112 | |||
113 | /** | ||
89 | * Prepare a statement. Prepared statements are automatically discarded | 114 | * Prepare a statement. Prepared statements are automatically discarded |
90 | * when the MySQL context is destroyed. | 115 | * when the MySQL context is destroyed. |
91 | * | 116 | * |
@@ -136,6 +161,30 @@ GNUNET_MYSQL_statement_run_prepared_select (struct GNUNET_MYSQL_Context *mc, | |||
136 | 161 | ||
137 | 162 | ||
138 | /** | 163 | /** |
164 | * Run a prepared SELECT statement. | ||
165 | * | ||
166 | * @param mc mysql context | ||
167 | * @param s statement to run | ||
168 | * @param result_size number of elements in results array | ||
169 | * @param results pointer to already initialized MYSQL_BIND | ||
170 | * array (of sufficient size) for passing results | ||
171 | * @param ap pairs and triplets of "MYSQL_TYPE_XXX" keys and their respective | ||
172 | * values (size + buffer-reference for pointers); terminated | ||
173 | * with "-1" | ||
174 | * @return GNUNET_SYSERR on error, otherwise | ||
175 | * the number of successfully affected (or queried) rows | ||
176 | */ | ||
177 | int | ||
178 | GNUNET_MYSQL_statement_run_prepared_select_va (struct GNUNET_MYSQL_Context *mc, | ||
179 | struct GNUNET_MYSQL_StatementHandle *s, | ||
180 | unsigned int result_size, | ||
181 | MYSQL_BIND * results, | ||
182 | GNUNET_MYSQL_DataProcessor processor, | ||
183 | void *processor_cls, | ||
184 | va_list ap); | ||
185 | |||
186 | |||
187 | /** | ||
139 | * Run a prepared statement that does NOT produce results. | 188 | * Run a prepared statement that does NOT produce results. |
140 | * | 189 | * |
141 | * @param mc mysql context | 190 | * @param mc mysql context |