diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-09-16 14:11:49 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-09-16 14:11:49 +0000 |
commit | 79453be1daf8fbda661a2bd1f701a9733f0ba8c8 (patch) | |
tree | 82ea5ccd3551772717165e27b2fc1cbe440bd4fa /src/dht/plugin_dhtlog_mysql_dump.c | |
parent | d60d07a2d5bab8f7df54508356cdde5d95665425 (diff) | |
download | gnunet-79453be1daf8fbda661a2bd1f701a9733f0ba8c8.tar.gz gnunet-79453be1daf8fbda661a2bd1f701a9733f0ba8c8.zip |
feature creep
Diffstat (limited to 'src/dht/plugin_dhtlog_mysql_dump.c')
-rw-r--r-- | src/dht/plugin_dhtlog_mysql_dump.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dht/plugin_dhtlog_mysql_dump.c b/src/dht/plugin_dhtlog_mysql_dump.c index f58d6782a..2582bca41 100644 --- a/src/dht/plugin_dhtlog_mysql_dump.c +++ b/src/dht/plugin_dhtlog_mysql_dump.c | |||
@@ -63,6 +63,8 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
63 | #define INSERT_TOPOLOGY_STMT "prepare insert_topology from 'INSERT INTO topology (trialuid, date, connections) "\ | 63 | #define INSERT_TOPOLOGY_STMT "prepare insert_topology from 'INSERT INTO topology (trialuid, date, connections) "\ |
64 | "VALUES (@temp_trial, ?, ?)'" | 64 | "VALUES (@temp_trial, ?, ?)'" |
65 | 65 | ||
66 | #define INSERT_ROUND_STMT "prepare insert_round from 'INSERT INTO rounds (trialuid, round_type, round_count, starttime) VALUES (@temp_trial, @rtype, @rcount, @curr_time)'" | ||
67 | |||
66 | #define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO extended_topology (topology_uid, uid_first, uid_second) "\ | 68 | #define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO extended_topology (topology_uid, uid_first, uid_second) "\ |
67 | "VALUES (@temp_topology, ?, ?)'" | 69 | "VALUES (@temp_topology, ?, ?)'" |
68 | 70 | ||
@@ -158,6 +160,7 @@ iopen () | |||
158 | #define PINIT(a) (GNUNET_OK != (prepared_statement_create(a))) | 160 | #define PINIT(a) (GNUNET_OK != (prepared_statement_create(a))) |
159 | if (PINIT (INSERT_QUERIES_STMT) || | 161 | if (PINIT (INSERT_QUERIES_STMT) || |
160 | PINIT (INSERT_ROUTES_STMT) || | 162 | PINIT (INSERT_ROUTES_STMT) || |
163 | PINIT (INSERT_ROUND_STMT) || | ||
161 | PINIT (INSERT_TRIALS_STMT) || | 164 | PINIT (INSERT_TRIALS_STMT) || |
162 | PINIT (SET_MALICIOUS_STMT) || | 165 | PINIT (SET_MALICIOUS_STMT) || |
163 | PINIT (INSERT_GENERIC_STAT_STMT) || | 166 | PINIT (INSERT_GENERIC_STAT_STMT) || |
@@ -181,7 +184,30 @@ iopen () | |||
181 | return GNUNET_OK; | 184 | return GNUNET_OK; |
182 | } | 185 | } |
183 | 186 | ||
187 | /* | ||
188 | * Inserts the specified round into the dhttests.rounds table | ||
189 | * | ||
190 | * @param round_type the type of round that is being started | ||
191 | * @param round_count counter for the round (if applicable) | ||
192 | * | ||
193 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||
194 | */ | ||
195 | int add_round (unsigned int round_type, unsigned int round_count) | ||
196 | { | ||
197 | int ret; | ||
198 | if (outfile == NULL) | ||
199 | return GNUNET_SYSERR; | ||
200 | |||
201 | ret = fprintf(outfile, "set @curr_time = \"%s\", @rtype = \"%u\", @rcount = \"%u\";\n", get_sql_time(), round_type, round_count); | ||
202 | |||
203 | if (ret < 0) | ||
204 | return GNUNET_SYSERR; | ||
205 | ret = fprintf(outfile, "execute insert_round;\n"); | ||
184 | 206 | ||
207 | if (ret >= 0) | ||
208 | return GNUNET_OK; | ||
209 | return GNUNET_SYSERR; | ||
210 | } | ||
185 | 211 | ||
186 | /* | 212 | /* |
187 | * Records the current topology (number of connections, time, trial) | 213 | * Records the current topology (number of connections, time, trial) |
@@ -813,6 +839,7 @@ libgnunet_plugin_dhtlog_mysql_dump_init (void * cls) | |||
813 | GNUNET_assert(plugin->dhtlog_api == NULL); | 839 | GNUNET_assert(plugin->dhtlog_api == NULL); |
814 | plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle)); | 840 | plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle)); |
815 | plugin->dhtlog_api->insert_trial = &add_trial; | 841 | plugin->dhtlog_api->insert_trial = &add_trial; |
842 | plugin->dhtlog_api->insert_round = &add_round; | ||
816 | plugin->dhtlog_api->insert_stat = &add_stat; | 843 | plugin->dhtlog_api->insert_stat = &add_stat; |
817 | plugin->dhtlog_api->insert_query = &add_query; | 844 | plugin->dhtlog_api->insert_query = &add_query; |
818 | plugin->dhtlog_api->update_trial = &update_trials; | 845 | plugin->dhtlog_api->update_trial = &update_trials; |