diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-07-29 09:41:53 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-07-29 09:41:53 +0000 |
commit | 356994ca3f6b589fb0228a4ae022e29488d7ae9b (patch) | |
tree | 83d81a9411026512e16623785a6d8d192d8e198b /src/psycstore | |
parent | d0952436974f4618d0f3d644c71ac096879fa4c7 (diff) | |
download | gnunet-356994ca3f6b589fb0228a4ae022e29488d7ae9b.tar.gz gnunet-356994ca3f6b589fb0228a4ae022e29488d7ae9b.zip |
fix fragment_row function
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/plugin_psycstore_mysql.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/psycstore/plugin_psycstore_mysql.c b/src/psycstore/plugin_psycstore_mysql.c index dfdb1cd67..209d50a3d 100644 --- a/src/psycstore/plugin_psycstore_mysql.c +++ b/src/psycstore/plugin_psycstore_mysql.c | |||
@@ -1026,6 +1026,7 @@ message_add_flags (void *cls, | |||
1026 | 1026 | ||
1027 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->update_message_flags; | 1027 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->update_message_flags; |
1028 | 1028 | ||
1029 | int sql_ret; | ||
1029 | int ret = GNUNET_SYSERR; | 1030 | int ret = GNUNET_SYSERR; |
1030 | 1031 | ||
1031 | struct GNUNET_MY_QueryParam params_update[] = { | 1032 | struct GNUNET_MY_QueryParam params_update[] = { |
@@ -1035,13 +1036,17 @@ message_add_flags (void *cls, | |||
1035 | GNUNET_MY_query_param_end | 1036 | GNUNET_MY_query_param_end |
1036 | }; | 1037 | }; |
1037 | 1038 | ||
1038 | if (GNUNET_OK != GNUNET_MY_exec_prepared (plugin->mc, | 1039 | sql_ret = GNUNET_MY_exec_prepared (plugin->mc, |
1039 | stmt, | 1040 | stmt, |
1040 | params_update)) | 1041 | params_update); |
1042 | switch(sql_ret) | ||
1041 | { | 1043 | { |
1042 | LOG_MYSQL(plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1044 | case GNUNET_OK: |
1045 | ret = GNUNET_OK; | ||
1046 | break; | ||
1047 | default: | ||
1048 | LOG_MYSQL(plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
1043 | "mysql execute prepared", stmt); | 1049 | "mysql execute prepared", stmt); |
1044 | return GNUNET_SYSERR; | ||
1045 | } | 1050 | } |
1046 | 1051 | ||
1047 | if (0 != mysql_stmt_reset (GNUNET_MYSQL_statement_get_stmt (stmt))) | 1052 | if (0 != mysql_stmt_reset (GNUNET_MYSQL_statement_get_stmt (stmt))) |
@@ -1151,16 +1156,18 @@ fragment_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stm | |||
1151 | int ret = GNUNET_SYSERR; | 1156 | int ret = GNUNET_SYSERR; |
1152 | int sql_ret; | 1157 | int sql_ret; |
1153 | 1158 | ||
1154 | struct GNUNET_MULTICAST_MessageHeader *msg | ||
1155 | = GNUNET_malloc (sizeof (*msg) + 0); | ||
1156 | |||
1157 | sql_ret = GNUNET_MY_exec_prepared (plugin->mc, | 1159 | sql_ret = GNUNET_MY_exec_prepared (plugin->mc, |
1158 | stmt, | 1160 | stmt, |
1159 | params); | 1161 | params); |
1160 | switch(sql_ret) | 1162 | switch(sql_ret) |
1161 | { | 1163 | { |
1164 | case GNUNET_NO: | ||
1165 | if (ret != GNUNET_OK) | ||
1166 | ret = GNUNET_NO; | ||
1167 | break; | ||
1162 | case GNUNET_YES: | 1168 | case GNUNET_YES: |
1163 | ret = fragment_row (stmt, cb, cb_cls); | 1169 | ret = fragment_row (stmt, cb, cb_cls); |
1170 | (*returned_fragments)++; | ||
1164 | break; | 1171 | break; |
1165 | default: | 1172 | default: |
1166 | LOG_MYSQL(plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1173 | LOG_MYSQL(plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -1187,9 +1194,7 @@ fragment_get (void *cls, | |||
1187 | void *cb_cls) | 1194 | void *cb_cls) |
1188 | { | 1195 | { |
1189 | struct Plugin *plugin = cls; | 1196 | struct Plugin *plugin = cls; |
1190 | |||
1191 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_fragments; | 1197 | struct GNUNET_MYSQL_StatementHandle *stmt = plugin->select_fragments; |
1192 | |||
1193 | int ret = GNUNET_SYSERR; | 1198 | int ret = GNUNET_SYSERR; |
1194 | *returned_fragments = 0; | 1199 | *returned_fragments = 0; |
1195 | 1200 | ||