diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-07-06 10:21:57 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-07-06 10:21:57 +0000 |
commit | 6db64c5eae089e1d81cafbb051f65412790d16bc (patch) | |
tree | 4623636ff871db29a14b69ffae37bba50a043411 /src/psycstore | |
parent | 954b30fbadafaeddb2556f15e005f22c1d96ebbb (diff) | |
download | gnunet-6db64c5eae089e1d81cafbb051f65412790d16bc.tar.gz gnunet-6db64c5eae089e1d81cafbb051f65412790d16bc.zip |
fix leak memory
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/Makefile.am | 6 | ||||
-rw-r--r-- | src/psycstore/plugin_psycstore_mysql.c | 236 |
2 files changed, 147 insertions, 95 deletions
diff --git a/src/psycstore/Makefile.am b/src/psycstore/Makefile.am index a527837de..add6b3ee9 100644 --- a/src/psycstore/Makefile.am +++ b/src/psycstore/Makefile.am | |||
@@ -56,9 +56,12 @@ plugin_LTLIBRARIES = \ | |||
56 | $(SQLITE_PLUGIN) | 56 | $(SQLITE_PLUGIN) |
57 | 57 | ||
58 | libgnunet_plugin_psycstore_sqlite_la_SOURCES = \ | 58 | libgnunet_plugin_psycstore_sqlite_la_SOURCES = \ |
59 | plugin_psycstore_sqlite.c | 59 | plugin_psycstore_sqlite.c \ |
60 | plugin_psycstore_mysql.c | ||
60 | libgnunet_plugin_psycstore_sqlite_la_LIBADD = \ | 61 | libgnunet_plugin_psycstore_sqlite_la_LIBADD = \ |
61 | libgnunetpsycstore.la \ | 62 | libgnunetpsycstore.la \ |
63 | $(top_builddir)/src/my/libgnunetmy.la \ | ||
64 | $(top_builddir)/src/mysql/libgnunetmysql.la \ | ||
62 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 65 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
63 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ | 66 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ |
64 | $(LTLIBINTL) | 67 | $(LTLIBINTL) |
@@ -95,3 +98,4 @@ test_plugin_psycstore_sqlite_SOURCES = \ | |||
95 | test_plugin_psycstore_sqlite_LDADD = \ | 98 | test_plugin_psycstore_sqlite_LDADD = \ |
96 | $(top_builddir)/src/testing/libgnunettesting.la \ | 99 | $(top_builddir)/src/testing/libgnunettesting.la \ |
97 | $(top_builddir)/src/util/libgnunetutil.la | 100 | $(top_builddir)/src/util/libgnunetutil.la |
101 | |||
diff --git a/src/psycstore/plugin_psycstore_mysql.c b/src/psycstore/plugin_psycstore_mysql.c index c766e1a6c..5226c296c 100644 --- a/src/psycstore/plugin_psycstore_mysql.c +++ b/src/psycstore/plugin_psycstore_mysql.c | |||
@@ -38,7 +38,11 @@ | |||
38 | #include "gnunet_crypto_lib.h" | 38 | #include "gnunet_crypto_lib.h" |
39 | #include "gnunet_psyc_util_lib.h" | 39 | #include "gnunet_psyc_util_lib.h" |
40 | #include "psycstore.h" | 40 | #include "psycstore.h" |
41 | #include "gnunet_my_lib.h" | ||
42 | #include "gnunet_mysql_lib.h" | ||
43 | |||
41 | #include <sqlite3.h> | 44 | #include <sqlite3.h> |
45 | #include <mysql/mysql.h> | ||
42 | 46 | ||
43 | /** | 47 | /** |
44 | * After how many ms "busy" should a DB operation fail for good? A | 48 | * After how many ms "busy" should a DB operation fail for good? A |
@@ -59,11 +63,9 @@ | |||
59 | * a failure of the command 'cmd' on file 'filename' | 63 | * a failure of the command 'cmd' on file 'filename' |
60 | * with the message given by strerror(errno). | 64 | * with the message given by strerror(errno). |
61 | */ | 65 | */ |
62 | #define LOG_SQLITE(db, level, cmd) do { GNUNET_log_from (level, "psycstore-sqlite", _("`%s' failed at %s:%d with error: %s (%d)\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh), sqlite3_errcode(db->dbh)); } while(0) | ||
63 | |||
64 | #define LOG_MYSQL(db, level, cmd, stmt) do { GNUNET_log_from (level, "psycstore-mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, mysql_stmt_error (stmt)); } while(0) | 66 | #define LOG_MYSQL(db, level, cmd, stmt) do { GNUNET_log_from (level, "psycstore-mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, mysql_stmt_error (stmt)); } while(0) |
65 | 67 | ||
66 | #define LOG(kind,...) GNUNET_log_from (kind, "psycstore-sqlite", __VA_ARGS__) | 68 | #define LOG(kind,...) GNUNET_log_from (kind, "psycstore-mysql", __VA_ARGS__) |
67 | 69 | ||
68 | enum Transactions { | 70 | enum Transactions { |
69 | TRANSACTION_NONE = 0, | 71 | TRANSACTION_NONE = 0, |
@@ -94,137 +96,137 @@ struct Plugin | |||
94 | */ | 96 | */ |
95 | enum Transactions transaction; | 97 | enum Transactions transaction; |
96 | 98 | ||
97 | GNUNET_MYSQL_StatementHandle *transaction_begin; | 99 | struct GNUNET_MYSQL_StatementHandle *transaction_begin; |
98 | 100 | ||
99 | GNUNET_MYSQL_StatementHandle *transaction_commit; | 101 | struct GNUNET_MYSQL_StatementHandle *transaction_commit; |
100 | 102 | ||
101 | GNUNET_MYSQL_StatementHandle *transaction_rollback; | 103 | struct GNUNET_MYSQL_StatementHandle *transaction_rollback; |
102 | 104 | ||
103 | /** | 105 | /** |
104 | * Precompiled SQL for channel_key_store() | 106 | * Precompiled SQL for channel_key_store() |
105 | */ | 107 | */ |
106 | GNUNET_MYSQL_StatementHandle *insert_channel_key; | 108 | struct GNUNET_MYSQL_StatementHandle *insert_channel_key; |
107 | 109 | ||
108 | 110 | ||
109 | /** | 111 | /** |
110 | * Precompiled SQL for slave_key_store() | 112 | * Precompiled SQL for slave_key_store() |
111 | */ | 113 | */ |
112 | GNUNET_MYSQL_StatementHandle *insert_slave_key; | 114 | struct GNUNET_MYSQL_StatementHandle *insert_slave_key; |
113 | 115 | ||
114 | /** | 116 | /** |
115 | * Precompiled SQL for membership_store() | 117 | * Precompiled SQL for membership_store() |
116 | */ | 118 | */ |
117 | GNUNET_MYSQL_StatementHandle *insert_membership; | 119 | struct GNUNET_MYSQL_StatementHandle *insert_membership; |
118 | 120 | ||
119 | /** | 121 | /** |
120 | * Precompiled SQL for membership_test() | 122 | * Precompiled SQL for membership_test() |
121 | */ | 123 | */ |
122 | GNUNET_MYSQL_StatementHandle *select_membership; | 124 | struct GNUNET_MYSQL_StatementHandle *select_membership; |
123 | 125 | ||
124 | /** | 126 | /** |
125 | * Precompiled SQL for fragment_store() | 127 | * Precompiled SQL for fragment_store() |
126 | */ | 128 | */ |
127 | GNUNET_MYSQL_StatementHandle *insert_fragment; | 129 | struct GNUNET_MYSQL_StatementHandle *insert_fragment; |
128 | 130 | ||
129 | /** | 131 | /** |
130 | * Precompiled SQL for message_add_flags() | 132 | * Precompiled SQL for message_add_flags() |
131 | */ | 133 | */ |
132 | GNUNET_MYSQL_StatementHandle *update_message_flags; | 134 | struct GNUNET_MYSQL_StatementHandle *update_message_flags; |
133 | 135 | ||
134 | /** | 136 | /** |
135 | * Precompiled SQL for fragment_get() | 137 | * Precompiled SQL for fragment_get() |
136 | */ | 138 | */ |
137 | GNUNET_MYSQL_StatementHandle *select_fragments; | 139 | struct GNUNET_MYSQL_StatementHandle *select_fragments; |
138 | 140 | ||
139 | /** | 141 | /** |
140 | * Precompiled SQL for fragment_get() | 142 | * Precompiled SQL for fragment_get() |
141 | */ | 143 | */ |
142 | GNUNET_MYSQL_StatementHandle *select_latest_fragments; | 144 | struct GNUNET_MYSQL_StatementHandle *select_latest_fragments; |
143 | 145 | ||
144 | /** | 146 | /** |
145 | * Precompiled SQL for message_get() | 147 | * Precompiled SQL for message_get() |
146 | */ | 148 | */ |
147 | GNUNET_MYSQL_StatementHandle *select_messages; | 149 | struct GNUNET_MYSQL_StatementHandle *select_messages; |
148 | 150 | ||
149 | /** | 151 | /** |
150 | * Precompiled SQL for message_get() | 152 | * Precompiled SQL for message_get() |
151 | */ | 153 | */ |
152 | GNUNET_MYSQL_StatementHandle *select_latest_messages; | 154 | struct GNUNET_MYSQL_StatementHandle *select_latest_messages; |
153 | 155 | ||
154 | /** | 156 | /** |
155 | * Precompiled SQL for message_get_fragment() | 157 | * Precompiled SQL for message_get_fragment() |
156 | */ | 158 | */ |
157 | GNUNET_MYSQL_StatementHandle *select_message_fragment; | 159 | struct GNUNET_MYSQL_StatementHandle *select_message_fragment; |
158 | 160 | ||
159 | /** | 161 | /** |
160 | * Precompiled SQL for counters_get_message() | 162 | * Precompiled SQL for counters_get_message() |
161 | */ | 163 | */ |
162 | GNUNET_MYSQL_StatementHandle *select_counters_message; | 164 | struct GNUNET_MYSQL_StatementHandle *select_counters_message; |
163 | 165 | ||
164 | /** | 166 | /** |
165 | * Precompiled SQL for counters_get_state() | 167 | * Precompiled SQL for counters_get_state() |
166 | */ | 168 | */ |
167 | GNUNET_MYSQL_StatementHandle *select_counters_state; | 169 | struct GNUNET_MYSQL_StatementHandle *select_counters_state; |
168 | 170 | ||
169 | /** | 171 | /** |
170 | * Precompiled SQL for state_modify_end() | 172 | * Precompiled SQL for state_modify_end() |
171 | */ | 173 | */ |
172 | GNUNET_MYSQL_StatementHandle *update_state_hash_message_id; | 174 | struct GNUNET_MYSQL_StatementHandle *update_state_hash_message_id; |
173 | 175 | ||
174 | /** | 176 | /** |
175 | * Precompiled SQL for state_sync_end() | 177 | * Precompiled SQL for state_sync_end() |
176 | */ | 178 | */ |
177 | GNUNET_MYSQL_StatementHandle *update_max_state_message_id; | 179 | struct GNUNET_MYSQL_StatementHandle *update_max_state_message_id; |
178 | 180 | ||
179 | /** | 181 | /** |
180 | * Precompiled SQL for state_modify_op() | 182 | * Precompiled SQL for state_modify_op() |
181 | */ | 183 | */ |
182 | GNUNET_MYSQL_StatementHandle *insert_state_current; | 184 | struct GNUNET_MYSQL_StatementHandle *insert_state_current; |
183 | 185 | ||
184 | /** | 186 | /** |
185 | * Precompiled SQL for state_modify_end() | 187 | * Precompiled SQL for state_modify_end() |
186 | */ | 188 | */ |
187 | GNUNET_MYSQL_StatementHandle *delete_state_empty; | 189 | struct GNUNET_MYSQL_StatementHandle *delete_state_empty; |
188 | 190 | ||
189 | /** | 191 | /** |
190 | * Precompiled SQL for state_set_signed() | 192 | * Precompiled SQL for state_set_signed() |
191 | */ | 193 | */ |
192 | GNUNET_MYSQL_StatementHandle *update_state_signed; | 194 | struct GNUNET_MYSQL_StatementHandle *update_state_signed; |
193 | 195 | ||
194 | /** | 196 | /** |
195 | * Precompiled SQL for state_sync() | 197 | * Precompiled SQL for state_sync() |
196 | */ | 198 | */ |
197 | GNUNET_MYSQL_StatementHandle *insert_state_sync; | 199 | struct GNUNET_MYSQL_StatementHandle *insert_state_sync; |
198 | 200 | ||
199 | /** | 201 | /** |
200 | * Precompiled SQL for state_sync() | 202 | * Precompiled SQL for state_sync() |
201 | */ | 203 | */ |
202 | GNUNET_MYSQL_StatementHandle *delete_state; | 204 | struct GNUNET_MYSQL_StatementHandle *delete_state; |
203 | 205 | ||
204 | /** | 206 | /** |
205 | * Precompiled SQL for state_sync() | 207 | * Precompiled SQL for state_sync() |
206 | */ | 208 | */ |
207 | GNUNET_MYSQL_StatementHandle *insert_state_from_sync; | 209 | struct GNUNET_MYSQL_StatementHandle *insert_state_from_sync; |
208 | 210 | ||
209 | /** | 211 | /** |
210 | * Precompiled SQL for state_sync() | 212 | * Precompiled SQL for state_sync() |
211 | */ | 213 | */ |
212 | GNUNET_MYSQL_StatementHandle *delete_state_sync; | 214 | struct GNUNET_MYSQL_StatementHandle *delete_state_sync; |
213 | 215 | ||
214 | /** | 216 | /** |
215 | * Precompiled SQL for state_get_signed() | 217 | * Precompiled SQL for state_get_signed() |
216 | */ | 218 | */ |
217 | GNUNET_MYSQL_StatementHandle *select_state_signed; | 219 | struct GNUNET_MYSQL_StatementHandle *select_state_signed; |
218 | 220 | ||
219 | /** | 221 | /** |
220 | * Precompiled SQL for state_get() | 222 | * Precompiled SQL for state_get() |
221 | */ | 223 | */ |
222 | GNUNET_MYSQL_StatementHandle *select_state_one; | 224 | struct GNUNET_MYSQL_StatementHandle *select_state_one; |
223 | 225 | ||
224 | /** | 226 | /** |
225 | * Precompiled SQL for state_get_prefix() | 227 | * Precompiled SQL for state_get_prefix() |
226 | */ | 228 | */ |
227 | GNUNET_MYSQL_StatementHandle *select_state_prefix; | 229 | struct GNUNET_MYSQL_StatementHandle *select_state_prefix; |
228 | 230 | ||
229 | }; | 231 | }; |
230 | 232 | ||
@@ -275,18 +277,18 @@ mysql_prepare (struct GNUNET_MYSQL_Context *mc, | |||
275 | */ | 277 | */ |
276 | static int | 278 | static int |
277 | mysql_exec (struct GNUNET_MYSQL_Context *mc, | 279 | mysql_exec (struct GNUNET_MYSQL_Context *mc, |
278 | struct GNUNET_MYSQL_Statement *sh, | 280 | struct GNUNET_MYSQL_StatementHandle *sh, |
279 | struct GNUNET_MY_QueryParam *qp) | 281 | struct GNUNET_MY_QueryParam *qp) |
280 | { | 282 | { |
281 | int result; | 283 | int result; |
282 | 284 | ||
283 | result = GNUNET_MY_exec_prepared (mc, sh, qp); | 285 | result = GNUNET_MY_exec_prepared (mc, sh, qp); |
284 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 286 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
285 | "Executed `%s' / %d\n", sql, result); | 287 | "Executed `GNUNET_MY_exec_prepared`' / %d\n", result); |
286 | if (GNUNET_OK != result) | 288 | if (GNUNET_OK != result) |
287 | LOG (GNUNET_ERROR_TYPE_ERROR, | 289 | LOG (GNUNET_ERROR_TYPE_ERROR, |
288 | _("Error executing SQL query: %s\n %s\n"), | 290 | _("Error executing SQL query: %s\n"), |
289 | mysql_stmt_error (GNUNET_MYSQL_statement_get_stmt (sh)), sql); | 291 | mysql_stmt_error (GNUNET_MYSQL_statement_get_stmt (sh))); |
290 | return result; | 292 | return result; |
291 | } | 293 | } |
292 | 294 | ||
@@ -639,6 +641,9 @@ database_shutdown (struct Plugin *plugin) | |||
639 | { | 641 | { |
640 | int result; | 642 | int result; |
641 | sqlite3_stmt *stmt; | 643 | sqlite3_stmt *stmt; |
644 | |||
645 | //MYSQL_STMT *stmt; | ||
646 | |||
642 | while (NULL != (stmt = sqlite3_next_stmt (plugin->dbh, NULL))) | 647 | while (NULL != (stmt = sqlite3_next_stmt (plugin->dbh, NULL))) |
643 | { | 648 | { |
644 | result = sqlite3_finalize (stmt); | 649 | result = sqlite3_finalize (stmt); |
@@ -683,7 +688,7 @@ exec_channel (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt, | |||
683 | 688 | ||
684 | if(GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, | 689 | if(GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, |
685 | stmt, | 690 | stmt, |
686 | results) | 691 | params)) |
687 | { | 692 | { |
688 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 693 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
689 | "mysql exec_channel", stmt); | 694 | "mysql exec_channel", stmt); |
@@ -706,7 +711,7 @@ exec_channel (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt, | |||
706 | static int | 711 | static int |
707 | transaction_begin (struct Plugin *plugin, enum Transactions transaction) | 712 | transaction_begin (struct Plugin *plugin, enum Transactions transaction) |
708 | { | 713 | { |
709 | GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_begin; | 714 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_begin; |
710 | MYSQL_STMT * statement = NULL; | 715 | MYSQL_STMT * statement = NULL; |
711 | 716 | ||
712 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 717 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -722,9 +727,9 @@ transaction_begin (struct Plugin *plugin, enum Transactions transaction) | |||
722 | GNUNET_MY_query_param_end | 727 | GNUNET_MY_query_param_end |
723 | }; | 728 | }; |
724 | 729 | ||
725 | if (GNUNET_OK != GNUNET_MY_extract_result (plugin->mc, | 730 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, |
726 | stmt, | 731 | stmt, |
727 | results)) | 732 | params)) |
728 | { | 733 | { |
729 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 734 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
730 | "mysql extract_result", statement); | 735 | "mysql extract_result", statement); |
@@ -749,7 +754,7 @@ transaction_begin (struct Plugin *plugin, enum Transactions transaction) | |||
749 | static int | 754 | static int |
750 | transaction_commit (struct Plugin *plugin) | 755 | transaction_commit (struct Plugin *plugin) |
751 | { | 756 | { |
752 | GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_commit; | 757 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_commit; |
753 | MYSQL_STMT *statement = NULL; | 758 | MYSQL_STMT *statement = NULL; |
754 | 759 | ||
755 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 760 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -767,14 +772,14 @@ transaction_commit (struct Plugin *plugin) | |||
767 | 772 | ||
768 | if (GNUNET_OK != GNUNET_MY_exec_prepared( plugin->mc, | 773 | if (GNUNET_OK != GNUNET_MY_exec_prepared( plugin->mc, |
769 | stmt, | 774 | stmt, |
770 | results)) | 775 | params)) |
771 | { | 776 | { |
772 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 777 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
773 | "mysql extract_result", statement); | 778 | "mysql extract_result", statement); |
774 | return GNUNET_SYSERR; | 779 | return GNUNET_SYSERR; |
775 | } | 780 | } |
776 | 781 | ||
777 | if (0 != mysql_stmt_reset (stmt)) | 782 | if (0 != mysql_stmt_reset (statement)) |
778 | { | 783 | { |
779 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 784 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
780 | "mysql_stmt_reset", statement); | 785 | "mysql_stmt_reset", statement); |
@@ -792,7 +797,7 @@ transaction_commit (struct Plugin *plugin) | |||
792 | static int | 797 | static int |
793 | transaction_rollback (struct Plugin *plugin) | 798 | transaction_rollback (struct Plugin *plugin) |
794 | { | 799 | { |
795 | GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_rollback; | 800 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->transaction_rollback; |
796 | MYSQL_STMT* statement = NULL; | 801 | MYSQL_STMT* statement = NULL; |
797 | 802 | ||
798 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 803 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -809,14 +814,14 @@ transaction_rollback (struct Plugin *plugin) | |||
809 | 814 | ||
810 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, | 815 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, |
811 | stmt, | 816 | stmt, |
812 | results)) | 817 | params)) |
813 | { | 818 | { |
814 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 819 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
815 | "mysql extract_result", statement); | 820 | "mysql extract_result", statement); |
816 | return GNUNET_SYSERR; | 821 | return GNUNET_SYSERR; |
817 | } | 822 | } |
818 | 823 | ||
819 | if (0 != mysql_stmt_reset (stmt)) | 824 | if (0 != mysql_stmt_reset (statement)) |
820 | { | 825 | { |
821 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 826 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
822 | "mysql_stmt_reset", statement); | 827 | "mysql_stmt_reset", statement); |
@@ -832,7 +837,7 @@ static int | |||
832 | channel_key_store (struct Plugin *plugin, | 837 | channel_key_store (struct Plugin *plugin, |
833 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) | 838 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) |
834 | { | 839 | { |
835 | GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_channel_key; | 840 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_channel_key; |
836 | 841 | ||
837 | MYSQL_STMT *statement = NULL; | 842 | MYSQL_STMT *statement = NULL; |
838 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 843 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -851,13 +856,20 @@ channel_key_store (struct Plugin *plugin, | |||
851 | 856 | ||
852 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, | 857 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, |
853 | stmt, | 858 | stmt, |
854 | results)) | 859 | params)) |
855 | { | 860 | { |
856 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 861 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
857 | "mysql extract_result", statement); | 862 | "mysql extract_result", statement); |
858 | return GNUNET_SYSERR; | 863 | return GNUNET_SYSERR; |
859 | } | 864 | } |
860 | 865 | ||
866 | if (0 != mysql_stmt_reset (statement)) | ||
867 | { | ||
868 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
869 | "mysql_stmt_reset", statement); | ||
870 | return GNUNET_SYSERR; | ||
871 | } | ||
872 | |||
861 | return GNUNET_OK; | 873 | return GNUNET_OK; |
862 | } | 874 | } |
863 | 875 | ||
@@ -866,7 +878,7 @@ static int | |||
866 | slave_key_store (struct Plugin *plugin, | 878 | slave_key_store (struct Plugin *plugin, |
867 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key) | 879 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key) |
868 | { | 880 | { |
869 | GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_slave_key; | 881 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_slave_key; |
870 | 882 | ||
871 | MYSQL_STMT *statement = NULL; | 883 | MYSQL_STMT *statement = NULL; |
872 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 884 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -885,14 +897,14 @@ slave_key_store (struct Plugin *plugin, | |||
885 | 897 | ||
886 | if (GNUNET_OK != GNUNET_MY_exec_prepared( plugin->mc, | 898 | if (GNUNET_OK != GNUNET_MY_exec_prepared( plugin->mc, |
887 | stmt, | 899 | stmt, |
888 | results)) | 900 | params)) |
889 | { | 901 | { |
890 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 902 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
891 | "mysql extract_result", statement); | 903 | "mysql extract_result", statement); |
892 | return GNUNET_SYSERR; | 904 | return GNUNET_SYSERR; |
893 | } | 905 | } |
894 | 906 | ||
895 | if (0 != mysql_stmt_reset (stmt)) | 907 | if (0 != mysql_stmt_reset (statement)) |
896 | { | 908 | { |
897 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 909 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
898 | "mysql_stmt_reset", statement); | 910 | "mysql_stmt_reset", statement); |
@@ -921,15 +933,16 @@ sqlite_membership_store (void *cls, | |||
921 | uint64_t group_generation) | 933 | uint64_t group_generation) |
922 | { | 934 | { |
923 | struct Plugin *plugin = cls; | 935 | struct Plugin *plugin = cls; |
924 | // sqlite3_stmt *stmt = plugin->insert_membership; | ||
925 | 936 | ||
926 | uint32_t idid_join = (uint32_t)did_join; | 937 | uint32_t idid_join = (uint32_t)did_join; |
927 | uint64_t iannounced_at = (uint64_t)announced_at; | 938 | uint64_t iannounced_at = (uint64_t)announced_at; |
928 | uint64_t ieffective_since = (uint64_t)effective_since; | 939 | uint64_t ieffective_since = (uint64_t)effective_since; |
929 | uint64_t igroup_generation = (uint64_t)group_generation; | 940 | uint64_t igroup_generation = (uint64_t)group_generation; |
930 | 941 | ||
931 | GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_membership; | 942 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_membership; |
943 | MYSQL_STMT *statement = NULL; | ||
932 | 944 | ||
945 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
933 | 946 | ||
934 | GNUNET_assert (TRANSACTION_NONE == plugin->transaction); | 947 | GNUNET_assert (TRANSACTION_NONE == plugin->transaction); |
935 | 948 | ||
@@ -964,7 +977,7 @@ sqlite_membership_store (void *cls, | |||
964 | return GNUNET_SYSERR; | 977 | return GNUNET_SYSERR; |
965 | } | 978 | } |
966 | 979 | ||
967 | if (0 != mysql_stmt_reset (stmt)) | 980 | if (0 != mysql_stmt_reset (statement)) |
968 | { | 981 | { |
969 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 982 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
970 | "mysql_stmt_reset", statement); | 983 | "mysql_stmt_reset", statement); |
@@ -988,8 +1001,8 @@ membership_test (void *cls, | |||
988 | uint64_t message_id) | 1001 | uint64_t message_id) |
989 | { | 1002 | { |
990 | struct Plugin *plugin = cls; | 1003 | struct Plugin *plugin = cls; |
991 | //sqlite3_stmt *stmt = plugin->select_membership; | 1004 | |
992 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_membership; | 1005 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_membership; |
993 | MYSQL_STMT *statement = NULL; | 1006 | MYSQL_STMT *statement = NULL; |
994 | 1007 | ||
995 | uint32_t did_join = 0; | 1008 | uint32_t did_join = 0; |
@@ -1043,7 +1056,7 @@ membership_test (void *cls, | |||
1043 | ret = GNUNET_NO; | 1056 | ret = GNUNET_NO; |
1044 | } | 1057 | } |
1045 | 1058 | ||
1046 | if (0 != mysql_stmt_reset (stmt)) | 1059 | if (0 != mysql_stmt_reset (statement)) |
1047 | { | 1060 | { |
1048 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1061 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1049 | "mysql_stmt_reset", statement); | 1062 | "mysql_stmt_reset", statement); |
@@ -1068,8 +1081,10 @@ fragment_store (void *cls, | |||
1068 | { | 1081 | { |
1069 | struct Plugin *plugin = cls; | 1082 | struct Plugin *plugin = cls; |
1070 | 1083 | ||
1071 | GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_fragment; | 1084 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->insert_fragment; |
1085 | MYSQL_STMT *statement = NULL; | ||
1072 | 1086 | ||
1087 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1073 | 1088 | ||
1074 | GNUNET_assert (TRANSACTION_NONE == plugin->transaction); | 1089 | GNUNET_assert (TRANSACTION_NONE == plugin->transaction); |
1075 | 1090 | ||
@@ -1094,16 +1109,16 @@ fragment_store (void *cls, | |||
1094 | 1109 | ||
1095 | struct GNUNET_MY_QueryParam params_insert[] = { | 1110 | struct GNUNET_MY_QueryParam params_insert[] = { |
1096 | GNUNET_MY_query_param_auto_from_type (channel_key), | 1111 | GNUNET_MY_query_param_auto_from_type (channel_key), |
1097 | GNUNET_MY_query_param_uint64 (&msg->hop_counter), | 1112 | GNUNET_MY_query_param_uint32 (msg->hop_counter), |
1098 | GNUNET_MY_query_param_auto_from_type (msg->signature), | 1113 | GNUNET_MY_query_param_auto_from_type (&msg->signature), |
1099 | GNUNET_MY_query_param_auto_from_type (msg->purpose), | 1114 | GNUNET_MY_query_param_auto_from_type (&msg->purpose), |
1100 | GNUNET_MY_query_param_uint64 (&fragment_id), | 1115 | GNUNET_MY_query_param_uint64 (&fragment_id), |
1101 | GNUNET_MY_query_param_uint64 (&fragment_offset), | 1116 | GNUNET_MY_query_param_uint64 (&fragment_offset), |
1102 | GNUNET_MY_query_param_uint64 (&message_id), | 1117 | GNUNET_MY_query_param_uint64 (&message_id), |
1103 | GNUNET_MY_query_param_uint64 (&group_generation), | 1118 | GNUNET_MY_query_param_uint64 (&group_generation), |
1104 | GNUNET_MY_query_param_uint64 (&msg->flags), | 1119 | GNUNET_MY_query_param_uint32 ( msg->flags), |
1105 | GNUNET_MY_query_param_uint64 (&psycstore_flags), | 1120 | GNUNET_MY_query_param_uint32 (&psycstore_flags), |
1106 | GNUNET_MY_query_param_auto_from_type (msg[1]), | 1121 | GNUNET_MY_query_param_auto_from_type (&msg[1]), |
1107 | GNUNET_MY_query_param_end | 1122 | GNUNET_MY_query_param_end |
1108 | }; | 1123 | }; |
1109 | 1124 | ||
@@ -1116,7 +1131,7 @@ fragment_store (void *cls, | |||
1116 | return GNUNET_SYSERR; | 1131 | return GNUNET_SYSERR; |
1117 | } | 1132 | } |
1118 | 1133 | ||
1119 | if (0 != mysql_stmt_reset (stmt)) | 1134 | if (0 != mysql_stmt_reset (statement)) |
1120 | { | 1135 | { |
1121 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1136 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1122 | "mysql_stmt_reset", statement); | 1137 | "mysql_stmt_reset", statement); |
@@ -1141,7 +1156,7 @@ message_add_flags (void *cls, | |||
1141 | { | 1156 | { |
1142 | struct Plugin *plugin = cls; | 1157 | struct Plugin *plugin = cls; |
1143 | 1158 | ||
1144 | GNUNET_MYSQL_StatementHandle *stmt = plugin->update_message_flags; | 1159 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->update_message_flags; |
1145 | MYSQL_STMT *statement = NULL; | 1160 | MYSQL_STMT *statement = NULL; |
1146 | 1161 | ||
1147 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 1162 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -1164,7 +1179,7 @@ message_add_flags (void *cls, | |||
1164 | return GNUNET_SYSERR; | 1179 | return GNUNET_SYSERR; |
1165 | } | 1180 | } |
1166 | 1181 | ||
1167 | if (0 != mysql_stmt_reset (stmt)) | 1182 | if (0 != mysql_stmt_reset (statement)) |
1168 | { | 1183 | { |
1169 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1184 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1170 | "mysql_stmt_reset", statement); | 1185 | "mysql_stmt_reset", statement); |
@@ -1254,7 +1269,16 @@ fragment_get (void *cls, | |||
1254 | { | 1269 | { |
1255 | struct Plugin *plugin = cls; | 1270 | struct Plugin *plugin = cls; |
1256 | 1271 | ||
1257 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_fragments; | 1272 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_fragments; |
1273 | MYSQL_STMT *statement = NULL; | ||
1274 | |||
1275 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1276 | if (NULL == statement) | ||
1277 | { | ||
1278 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
1279 | "mysql get_stmt", statement); | ||
1280 | return GNUNET_SYSERR; | ||
1281 | } | ||
1258 | 1282 | ||
1259 | int ret = GNUNET_SYSERR; | 1283 | int ret = GNUNET_SYSERR; |
1260 | *returned_fragments = 0; | 1284 | *returned_fragments = 0; |
@@ -1268,7 +1292,7 @@ fragment_get (void *cls, | |||
1268 | 1292 | ||
1269 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); | 1293 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); |
1270 | 1294 | ||
1271 | if (0 != mysql_stmt_reset (stmt)) | 1295 | if (0 != mysql_stmt_reset (statement)) |
1272 | { | 1296 | { |
1273 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1297 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1274 | "mysql_stmt_reset", statement); | 1298 | "mysql_stmt_reset", statement); |
@@ -1296,7 +1320,10 @@ fragment_get_latest (void *cls, | |||
1296 | { | 1320 | { |
1297 | struct Plugin *plugin = cls; | 1321 | struct Plugin *plugin = cls; |
1298 | 1322 | ||
1299 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_latest_fragments; | 1323 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_latest_fragments; |
1324 | MYSQL_STMT * statement = NULL; | ||
1325 | |||
1326 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1300 | 1327 | ||
1301 | int ret = GNUNET_SYSERR; | 1328 | int ret = GNUNET_SYSERR; |
1302 | *returned_fragments = 0; | 1329 | *returned_fragments = 0; |
@@ -1309,7 +1336,7 @@ fragment_get_latest (void *cls, | |||
1309 | 1336 | ||
1310 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); | 1337 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); |
1311 | 1338 | ||
1312 | if (0 != mysql_stmt_reset (stmt)) | 1339 | if (0 != mysql_stmt_reset (statement)) |
1313 | { | 1340 | { |
1314 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1341 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1315 | "mysql_stmt_reset", statement); | 1342 | "mysql_stmt_reset", statement); |
@@ -1338,13 +1365,16 @@ message_get (void *cls, | |||
1338 | void *cb_cls) | 1365 | void *cb_cls) |
1339 | { | 1366 | { |
1340 | struct Plugin *plugin = cls; | 1367 | struct Plugin *plugin = cls; |
1341 | // sqlite3_stmt *stmt = plugin->select_messages; | 1368 | |
1342 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_messages; | 1369 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_messages; |
1370 | MYSQL_STMT *statement = NULL; | ||
1371 | |||
1372 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1343 | 1373 | ||
1344 | int ret = GNUNET_SYSERR; | 1374 | int ret = GNUNET_SYSERR; |
1345 | *returned_fragments = 0; | 1375 | *returned_fragments = 0; |
1346 | 1376 | ||
1347 | struct GNUNET_MY_QueryParams params_select[] = { | 1377 | struct GNUNET_MY_QueryParam params_select[] = { |
1348 | GNUNET_MY_query_param_auto_from_type (channel_key), | 1378 | GNUNET_MY_query_param_auto_from_type (channel_key), |
1349 | GNUNET_MY_query_param_uint64 (&first_message_id), | 1379 | GNUNET_MY_query_param_uint64 (&first_message_id), |
1350 | GNUNET_MY_query_param_uint64 (&last_message_id), | 1380 | GNUNET_MY_query_param_uint64 (&last_message_id), |
@@ -1354,7 +1384,7 @@ message_get (void *cls, | |||
1354 | 1384 | ||
1355 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); | 1385 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); |
1356 | 1386 | ||
1357 | if (0 != mysql_stmt_reset (stmt)) | 1387 | if (0 != mysql_stmt_reset (statement)) |
1358 | { | 1388 | { |
1359 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1389 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1360 | "mysql_stmt_reset", statement); | 1390 | "mysql_stmt_reset", statement); |
@@ -1382,7 +1412,10 @@ message_get_latest (void *cls, | |||
1382 | { | 1412 | { |
1383 | struct Plugin *plugin = cls; | 1413 | struct Plugin *plugin = cls; |
1384 | 1414 | ||
1385 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_latest_messages; | 1415 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_latest_messages; |
1416 | MYSQL_STMT *statement; | ||
1417 | |||
1418 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1386 | 1419 | ||
1387 | int ret = GNUNET_SYSERR; | 1420 | int ret = GNUNET_SYSERR; |
1388 | *returned_fragments = 0; | 1421 | *returned_fragments = 0; |
@@ -1396,7 +1429,7 @@ message_get_latest (void *cls, | |||
1396 | 1429 | ||
1397 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); | 1430 | ret = fragment_select (plugin, stmt, returned_fragments, cb, cb_cls); |
1398 | 1431 | ||
1399 | if (0 != mysql_stmt_reset (stmt)) | 1432 | if (0 != mysql_stmt_reset (statement)) |
1400 | { | 1433 | { |
1401 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1434 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1402 | "mysql_stmt_reset", statement); | 1435 | "mysql_stmt_reset", statement); |
@@ -1425,7 +1458,10 @@ message_get_fragment (void *cls, | |||
1425 | { | 1458 | { |
1426 | struct Plugin *plugin = cls; | 1459 | struct Plugin *plugin = cls; |
1427 | 1460 | ||
1428 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_message_fragment; | 1461 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_message_fragment; |
1462 | MYSQL_STMT *statement = NULL; | ||
1463 | |||
1464 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1429 | 1465 | ||
1430 | int ret = GNUNET_SYSERR; | 1466 | int ret = GNUNET_SYSERR; |
1431 | 1467 | ||
@@ -1447,7 +1483,7 @@ message_get_fragment (void *cls, | |||
1447 | 1483 | ||
1448 | ret = fragment_row (stmt, cb, cb_cls); | 1484 | ret = fragment_row (stmt, cb, cb_cls); |
1449 | 1485 | ||
1450 | if (0 != mysql_stmt_reset (stmt)) | 1486 | if (0 != mysql_stmt_reset (statement)) |
1451 | { | 1487 | { |
1452 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1488 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1453 | "mysql_stmt_reset", statement); | 1489 | "mysql_stmt_reset", statement); |
@@ -1472,7 +1508,8 @@ counters_message_get (void *cls, | |||
1472 | uint64_t *max_group_generation) | 1508 | uint64_t *max_group_generation) |
1473 | { | 1509 | { |
1474 | struct Plugin *plugin = cls; | 1510 | struct Plugin *plugin = cls; |
1475 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_counters_message; | 1511 | |
1512 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_counters_message; | ||
1476 | MYSQL_STMT *statement = NULL; | 1513 | MYSQL_STMT *statement = NULL; |
1477 | 1514 | ||
1478 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 1515 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -1516,7 +1553,7 @@ counters_message_get (void *cls, | |||
1516 | return GNUNET_SYSERR; | 1553 | return GNUNET_SYSERR; |
1517 | } | 1554 | } |
1518 | 1555 | ||
1519 | if (0 != mysql_stmt_reset (stmt)) | 1556 | if (0 != mysql_stmt_reset (statement)) |
1520 | { | 1557 | { |
1521 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1558 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1522 | "mysql_stmt_reset", statement); | 1559 | "mysql_stmt_reset", statement); |
@@ -1540,7 +1577,7 @@ counters_state_get (void *cls, | |||
1540 | { | 1577 | { |
1541 | struct Plugin *plugin = cls; | 1578 | struct Plugin *plugin = cls; |
1542 | 1579 | ||
1543 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_counters_state; | 1580 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_counters_state; |
1544 | MYSQL_STMT *statement = NULL; | 1581 | MYSQL_STMT *statement = NULL; |
1545 | 1582 | ||
1546 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 1583 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
@@ -1582,7 +1619,7 @@ counters_state_get (void *cls, | |||
1582 | return GNUNET_SYSERR; | 1619 | return GNUNET_SYSERR; |
1583 | } | 1620 | } |
1584 | 1621 | ||
1585 | if (0 != mysql_stmt_reset (stmt)) | 1622 | if (0 != mysql_stmt_reset (statement)) |
1586 | { | 1623 | { |
1587 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1624 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1588 | "mysql_stmt_reset", statement); | 1625 | "mysql_stmt_reset", statement); |
@@ -1599,7 +1636,7 @@ counters_state_get (void *cls, | |||
1599 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 1636 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
1600 | */ | 1637 | */ |
1601 | static int | 1638 | static int |
1602 | state_assign (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | 1639 | state_assign (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt, |
1603 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 1640 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
1604 | const char *name, const void *value, size_t value_size) | 1641 | const char *name, const void *value, size_t value_size) |
1605 | { | 1642 | { |
@@ -1633,7 +1670,7 @@ state_assign (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | |||
1633 | return GNUNET_SYSERR; | 1670 | return GNUNET_SYSERR; |
1634 | } | 1671 | } |
1635 | 1672 | ||
1636 | if (0 != mysql_stmt_reset (stmt)) | 1673 | if (0 != mysql_stmt_reset (statement)) |
1637 | { | 1674 | { |
1638 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1675 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1639 | "mysql_stmt_reset", statement); | 1676 | "mysql_stmt_reset", statement); |
@@ -1645,7 +1682,7 @@ state_assign (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | |||
1645 | 1682 | ||
1646 | 1683 | ||
1647 | static int | 1684 | static int |
1648 | update_message_id (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | 1685 | update_message_id (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt, |
1649 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 1686 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
1650 | uint64_t message_id) | 1687 | uint64_t message_id) |
1651 | { | 1688 | { |
@@ -1661,7 +1698,7 @@ update_message_id (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | |||
1661 | 1698 | ||
1662 | struct GNUNET_MY_QueryParam params[] = { | 1699 | struct GNUNET_MY_QueryParam params[] = { |
1663 | GNUNET_MY_query_param_uint64 (&message_id), | 1700 | GNUNET_MY_query_param_uint64 (&message_id), |
1664 | GNUNET_MY_query_param_auto_from_type (channel_id), | 1701 | GNUNET_MY_query_param_auto_from_type (channel_key), |
1665 | GNUNET_MY_query_param_end | 1702 | GNUNET_MY_query_param_end |
1666 | }; | 1703 | }; |
1667 | 1704 | ||
@@ -1674,7 +1711,7 @@ update_message_id (struct Plugin *plugin, GNUNET_MYSQL_StatementHandle *stmt, | |||
1674 | return GNUNET_SYSERR; | 1711 | return GNUNET_SYSERR; |
1675 | } | 1712 | } |
1676 | 1713 | ||
1677 | if (0 != mysql_stmt_reset (stmt)) | 1714 | if (0 != mysql_stmt_reset (statement)) |
1678 | { | 1715 | { |
1679 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1716 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1680 | "mysql_stmt_reset", statement); | 1717 | "mysql_stmt_reset", statement); |
@@ -1892,7 +1929,10 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | |||
1892 | struct Plugin *plugin = cls; | 1929 | struct Plugin *plugin = cls; |
1893 | int ret = GNUNET_SYSERR; | 1930 | int ret = GNUNET_SYSERR; |
1894 | 1931 | ||
1895 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_one; | 1932 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_one; |
1933 | MYSQL_STMT *statement = NULL; | ||
1934 | |||
1935 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
1896 | 1936 | ||
1897 | struct GNUNET_MY_QueryParam params_select[] = { | 1937 | struct GNUNET_MY_QueryParam params_select[] = { |
1898 | GNUNET_MY_query_param_auto_from_type (channel_key), | 1938 | GNUNET_MY_query_param_auto_from_type (channel_key), |
@@ -1910,7 +1950,7 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | |||
1910 | ret = cb (cb_cls, name, sqlite3_column_blob (stmt, 0), | 1950 | ret = cb (cb_cls, name, sqlite3_column_blob (stmt, 0), |
1911 | sqlite3_column_bytes (stmt, 0)); | 1951 | sqlite3_column_bytes (stmt, 0)); |
1912 | 1952 | ||
1913 | if (0 != mysql_stmt_reset (stmt)) | 1953 | if (0 != mysql_stmt_reset (statement)) |
1914 | { | 1954 | { |
1915 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1955 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1916 | "mysql_stmt_reset", statement); | 1956 | "mysql_stmt_reset", statement); |
@@ -1936,7 +1976,7 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_ | |||
1936 | struct Plugin *plugin = cls; | 1976 | struct Plugin *plugin = cls; |
1937 | int ret = GNUNET_SYSERR; | 1977 | int ret = GNUNET_SYSERR; |
1938 | 1978 | ||
1939 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_prefix; | 1979 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_prefix; |
1940 | MYSQL_STMT *statement = NULL; | 1980 | MYSQL_STMT *statement = NULL; |
1941 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | 1981 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); |
1942 | 1982 | ||
@@ -1974,7 +2014,7 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_ | |||
1974 | sqlite3_column_blob (stmt, 1), | 2014 | sqlite3_column_blob (stmt, 1), |
1975 | sqlite3_column_bytes (stmt, 1)); | 2015 | sqlite3_column_bytes (stmt, 1)); |
1976 | 2016 | ||
1977 | if (0 != mysql_stmt_reset (stmt)) | 2017 | if (0 != mysql_stmt_reset (statement)) |
1978 | { | 2018 | { |
1979 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 2019 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1980 | "mysql_stmt_reset", statement); | 2020 | "mysql_stmt_reset", statement); |
@@ -2000,8 +2040,16 @@ state_get_signed (void *cls, | |||
2000 | struct Plugin *plugin = cls; | 2040 | struct Plugin *plugin = cls; |
2001 | int ret = GNUNET_SYSERR; | 2041 | int ret = GNUNET_SYSERR; |
2002 | 2042 | ||
2003 | //sqlite3_stmt *stmt = plugin->select_state_signed; | 2043 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_signed; |
2004 | GNUNET_MYSQL_StatementHandle *stmt = plugin->select_state_signed; | 2044 | MYSQL_STMT *statement = NULL; |
2045 | |||
2046 | statement = GNUNET_MYSQL_statement_get_stmt (stmt); | ||
2047 | if (NULL == statement) | ||
2048 | { | ||
2049 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
2050 | "mysql get_stmt", statement); | ||
2051 | return GNUNET_SYSERR; | ||
2052 | } | ||
2005 | 2053 | ||
2006 | struct GNUNET_MY_QueryParam params_select[] = { | 2054 | struct GNUNET_MY_QueryParam params_select[] = { |
2007 | GNUNET_MY_query_param_auto_from_type (channel_key), | 2055 | GNUNET_MY_query_param_auto_from_type (channel_key), |
@@ -2025,7 +2073,7 @@ state_get_signed (void *cls, | |||
2025 | sqlite3_column_blob (stmt, 1), | 2073 | sqlite3_column_blob (stmt, 1), |
2026 | sqlite3_column_bytes (stmt, 1)); | 2074 | sqlite3_column_bytes (stmt, 1)); |
2027 | 2075 | ||
2028 | if (0 != mysql_stmt_reset (stmt)) | 2076 | if (0 != mysql_stmt_reset (statement)) |
2029 | { | 2077 | { |
2030 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 2078 | LOG_MYSQL (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
2031 | "mysql_stmt_reset", statement); | 2079 | "mysql_stmt_reset", statement); |