aboutsummaryrefslogtreecommitdiff
path: root/src/my/test_my.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-07 11:47:47 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-07 11:47:47 +0000
commit1893283990d3c128c67da900fde4b8c71b1939a7 (patch)
tree288ff80a631e6c169340b4ba3508c387c146f220 /src/my/test_my.c
parentf1a8e79f1cff6a135297cf4eabb6db4733456ad5 (diff)
downloadgnunet-1893283990d3c128c67da900fde4b8c71b1939a7.tar.gz
gnunet-1893283990d3c128c67da900fde4b8c71b1939a7.zip
-fix misc issues
Diffstat (limited to 'src/my/test_my.c')
-rw-r--r--src/my/test_my.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/src/my/test_my.c b/src/my/test_my.c
index b8b5faf33..f0766ac2c 100644
--- a/src/my/test_my.c
+++ b/src/my/test_my.c
@@ -37,7 +37,7 @@
37static int 37static int
38run_queries (struct GNUNET_MYSQL_Context *context) 38run_queries (struct GNUNET_MYSQL_Context *context)
39{ 39{
40 struct GNUNET_CRYPTO_RsaPublicKey *pub; 40 struct GNUNET_CRYPTO_RsaPublicKey *pub;
41 struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL; 41 struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL;
42 struct GNUNET_CRYPTO_RsaSignature *sig; 42 struct GNUNET_CRYPTO_RsaSignature *sig;
43 struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL; 43 struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL;
@@ -154,12 +154,12 @@ run_queries (struct GNUNET_MYSQL_Context *context)
154 " ORDER BY abs_time DESC " 154 " ORDER BY abs_time DESC "
155 " LIMIT 1;"); 155 " LIMIT 1;");
156 156
157*/ 157*/
158 statements_handle_select = GNUNET_MYSQL_statement_prepare (context, 158 statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
159 "SELECT" 159 "SELECT"
160 //" pub" 160 " pub"
161 //" sig" 161 ",sig"
162 " abs_time" 162 ",abs_time"
163 ",forever" 163 ",forever"
164 ",hash" 164 ",hash"
165 ",vsize" 165 ",vsize"
@@ -201,8 +201,8 @@ run_queries (struct GNUNET_MYSQL_Context *context)
201 }; 201 };
202*/ 202*/
203 struct GNUNET_MY_ResultSpec results_select[] = { 203 struct GNUNET_MY_ResultSpec results_select[] = {
204 //GNUNET_MY_result_spec_rsa_public_key (&pub2), 204 GNUNET_MY_result_spec_rsa_public_key (&pub2),
205 //GNUNET_MY_result_spec_rsa_signature (&sig2), 205 GNUNET_MY_result_spec_rsa_signature (&sig2),
206 GNUNET_MY_result_spec_absolute_time (&abs_time2), 206 GNUNET_MY_result_spec_absolute_time (&abs_time2),
207 GNUNET_MY_result_spec_absolute_time (&forever2), 207 GNUNET_MY_result_spec_absolute_time (&forever2),
208 GNUNET_MY_result_spec_auto_from_type (&hc2), 208 GNUNET_MY_result_spec_auto_from_type (&hc2),
@@ -244,12 +244,11 @@ run_queries (struct GNUNET_MYSQL_Context *context)
244} 244}
245 245
246 246
247int 247int
248main (int argc, const char * const argv[]) 248main (int argc, const char * const argv[])
249{ 249{
250 struct GNUNET_CONFIGURATION_Handle *config; 250 struct GNUNET_CONFIGURATION_Handle *config;
251 struct GNUNET_MYSQL_Context *context; 251 struct GNUNET_MYSQL_Context *context;
252
253 int ret; 252 int ret;
254 253
255 GNUNET_log_setup ( "test-my", 254 GNUNET_log_setup ( "test-my",
@@ -257,19 +256,13 @@ main (int argc, const char * const argv[])
257 NULL); 256 NULL);
258 257
259 config = GNUNET_CONFIGURATION_create (); 258 config = GNUNET_CONFIGURATION_create ();
260 if (NULL == config)
261 {
262 fprintf (stderr, "Failed to create a configuration\n");
263 return 1;
264 }
265
266 if (GNUNET_OK != GNUNET_CONFIGURATION_parse (config, "test_my.conf")) 259 if (GNUNET_OK != GNUNET_CONFIGURATION_parse (config, "test_my.conf"))
267 { 260 {
268 fprintf (stderr, "Failed to parse configuaration\n"); 261 fprintf (stderr, "Failed to parse configuaration\n");
269 return 1; 262 return 1;
270 } 263 }
271 264
272 context = GNUNET_MYSQL_context_create (config, 265 context = GNUNET_MYSQL_context_create (config,
273 "datastore-mysql"); 266 "datastore-mysql");
274 if (NULL == context) 267 if (NULL == context)
275 { 268 {
@@ -277,24 +270,26 @@ main (int argc, const char * const argv[])
277 return 77; 270 return 77;
278 } 271 }
279 272
273 (void) GNUNET_MYSQL_statement_run (context,
274 "DROP TABLE test_my2;");
280 if (GNUNET_OK != GNUNET_MYSQL_statement_run (context, 275 if (GNUNET_OK != GNUNET_MYSQL_statement_run (context,
281 "CREATE TABLE test_my2(" 276 "CREATE TABLE IF NOT EXISTS test_my2("
282 "pub BLOB NOT NULL" 277 " pub BLOB NOT NULL"
283 ", sig BLOB NOT NULL" 278 ",sig BLOB NOT NULL"
284 ", abs_time BIGINT NOT NULL" 279 ",abs_time BIGINT NOT NULL"
285 ", forever BIGINT NOT NULL" 280 ",forever BIGINT NOT NULL"
286 ", hash BLOB NOT NULL CHECK(LENGTH(hash)=64)" 281 ",hash BLOB NOT NULL CHECK(LENGTH(hash)=64)"
287 ", vsize BLOB NOT NULL" 282 ",vsize BLOB NOT NULL"
288 ", u16 SMALLINT NOT NULL" 283 ",u16 SMALLINT NOT NULL"
289 ", u32 INT NOT NULL" 284 ",u32 INT NOT NULL"
290 ", u64 BIGINT NOT NULL" 285 ",u64 BIGINT NOT NULL"
291 ")")) 286 ")"))
292 { 287 {
293 fprintf (stderr, 288 fprintf (stderr,
294 "Failed to create table \n"); 289 "Failed to create table \n");
295 GNUNET_MYSQL_statements_invalidate (context); 290 GNUNET_MYSQL_statements_invalidate (context);
296 GNUNET_MYSQL_context_destroy (context); 291 GNUNET_MYSQL_context_destroy (context);
297 292
298 return 1; 293 return 1;
299 } 294 }
300 295
@@ -308,11 +303,11 @@ main (int argc, const char * const argv[])
308 ", u64 BIGINT NOT NULL" 303 ", u64 BIGINT NOT NULL"
309 ")")) 304 ")"))
310 { 305 {
311 fprintf (stderr, 306 fprintf (stderr,
312 "Failed to create table \n"); 307 "Failed to create table \n");
313 GNUNET_MYSQL_statements_invalidate (context); 308 GNUNET_MYSQL_statements_invalidate (context);
314 GNUNET_MYSQL_context_destroy (context); 309 GNUNET_MYSQL_context_destroy (context);
315 310
316 return 1; 311 return 1;
317 } 312 }
318*/ 313*/