aboutsummaryrefslogtreecommitdiff
path: root/src/my
diff options
context:
space:
mode:
authorChristophe Genevey Metat <genevey.christophe@gmail.com>2016-05-27 13:51:30 +0000
committerChristophe Genevey Metat <genevey.christophe@gmail.com>2016-05-27 13:51:30 +0000
commite0c01618605c1ef2901b2002aed6801858603305 (patch)
tree48bfc163f5df1175c8d3f68af109b767b306ffc4 /src/my
parent3a07b1224ad0bb546bb864724d404eff503614cf (diff)
downloadgnunet-e0c01618605c1ef2901b2002aed6801858603305.tar.gz
gnunet-e0c01618605c1ef2901b2002aed6801858603305.zip
begin to rewritten test case
Diffstat (limited to 'src/my')
-rw-r--r--src/my/test_my.c77
1 files changed, 69 insertions, 8 deletions
diff --git a/src/my/test_my.c b/src/my/test_my.c
index 29c60f68d..b20dbdc3a 100644
--- a/src/my/test_my.c
+++ b/src/my/test_my.c
@@ -136,7 +136,7 @@ run_queries (MYSQL * mysql)
136 u32 = 32; 136 u32 = 32;
137 u64 = 64; 137 u64 = 64;
138 138
139 struct GNUNET_CONFIGURATION_Handle * configuration_handle = NULL; 139// struct GNUNET_CONFIGURATION_Handle * configuration_handle = NULL;
140// configuration_handle = GNUNET_CONFIGURATION_create(); 140// configuration_handle = GNUNET_CONFIGURATION_create();
141 141
142/* char *query1 = "INSERT INTO test_my (" 142/* char *query1 = "INSERT INTO test_my ("
@@ -291,15 +291,78 @@ run_queries (MYSQL * mysql)
291} 291}
292 292
293 293
294/** OK **/ 294/** REWRITTEN THIS FUNCTION **/
295int 295int
296main (int argc, const char * const argv[]) 296main (int argc, const char * const argv[])
297{ 297{
298 return GNUNET_OK; 298 //CREATE A CONTEXTE
299// MYSQL mysql ; 299 struct GNUNET_DATASTORE_PluginEnvironment *env;
300// MYSQL_RES *result; 300 struct GNUNET_MYSQL_Context *context;
301
302 GNUNET_log_setup ( "test-my",
303 "WARNING",
304 NULL);
305
306 context = GNUNET_MYSQL_context_create (NULL /* TO FIXE ***/,
307 "datastore-mysql");
308
309 struct GNUNET_MYSQL_StatementHandle *statements_handle;
310
311 statements_handle = GNUNET_MYSQL_statement_prepare (context,
312 "CREATE TABLE test_my("
313 "pub INT"
314 ", sig INT"
315 ", abs_time BIGINT"
316 ", forever BIGINT"
317 ", hash INT"
318 ", vsize VARCHAR"
319 ", u16 SMALLINT"
320 ", u32 INT"
321 ", u64 BIGINT"
322 ")");
323
324 //USE GNUNET_MY_exec_prepared
325 GNUNET_MY_exec_prepared(context,
326 statements_handle,
327 NULL);
328
329 if (GNUNET_OK != GNUNET_MYSQL_context_destroy (context))
330 {
331 //ERROR
332 }
333
334 return GNUNET_OK;
335
336/* NEW VERSION TO FIXE if (GNUNET_OK !=
337 mysql_prepare (&mysql))
338 {
339 GNUNET_break (0) ;
340 mysql_close (&mysql);
341 return 1;
342 }
343
344 int ret;
345 ret = run_queries (&mysql);
346
347
348 if (mysql_query (&mysql,
349 "DROP TABLE test_my;"))
350 {
351 fprintf (stderr, "Failed to drop table : %s\n",
352 mysql_error (&mysql));
353 mysql_close (&mysql);
354 return 1;
355 }
356
357*/
358/* OLD VERSION (use SQL basic function)
359
360 ret = run_queries ();
361
362 MYSQL mysql ;
363 MYSQL_RES *result;
301 364
302/* int ret; 365 int ret;
303 366
304 char *hote = ""; 367 char *hote = "";
305 char *pseudo = ""; 368 char *pseudo = "";
@@ -375,6 +438,4 @@ main (int argc, const char * const argv[])
375 438
376 return ret; 439 return ret;
377*/ 440*/
378// mysql_close (&mysql);
379// return GNUNET_OK;
380} 441}