gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37210 - in gnunet/src: include my


From: gnunet
Subject: [GNUnet-SVN] r37210 - in gnunet/src: include my
Date: Fri, 27 May 2016 15:51:30 +0200

Author: christophe.genevey
Date: 2016-05-27 15:51:30 +0200 (Fri, 27 May 2016)
New Revision: 37210

Modified:
   gnunet/src/include/gnunet_my_lib.h
   gnunet/src/my/test_my.c
Log:
begin to rewritten test case

Modified: gnunet/src/include/gnunet_my_lib.h
===================================================================
--- gnunet/src/include/gnunet_my_lib.h  2016-05-27 11:22:25 UTC (rev 37209)
+++ gnunet/src/include/gnunet_my_lib.h  2016-05-27 13:51:30 UTC (rev 37210)
@@ -141,6 +141,12 @@
 struct GNUNET_MY_ResultParam;
 
 /**
+ * Information we pass to #GNUNET_MY_extract_result() to
+ * initialize the arguments of the prepared statement.
+ */
+struct GNUNET_MY_ResultSpec;
+
+/**
  * Function called to convert input argument into SQL parameters.
  *
  * @param cls closure

Modified: gnunet/src/my/test_my.c
===================================================================
--- gnunet/src/my/test_my.c     2016-05-27 11:22:25 UTC (rev 37209)
+++ gnunet/src/my/test_my.c     2016-05-27 13:51:30 UTC (rev 37210)
@@ -136,7 +136,7 @@
      u32 = 32;
      u64 = 64;
 
-     struct GNUNET_CONFIGURATION_Handle * configuration_handle = NULL;
+//     struct GNUNET_CONFIGURATION_Handle * configuration_handle = NULL;
 //     configuration_handle = GNUNET_CONFIGURATION_create();
 
 /*     char *query1 =  "INSERT INTO test_my ("
@@ -291,16 +291,79 @@
 }
 
 
-/** OK **/
+/** REWRITTEN THIS FUNCTION **/
 int 
 main (int argc, const char * const argv[])
 {
-     return GNUNET_OK;     
-//     MYSQL mysql ;
-//     MYSQL_RES *result;
+     //CREATE A CONTEXTE 
+     struct GNUNET_DATASTORE_PluginEnvironment *env;
+     struct GNUNET_MYSQL_Context *context;
 
-/*     int ret;
+     GNUNET_log_setup (  "test-my",
+                         "WARNING",
+                         NULL);
 
+     context = GNUNET_MYSQL_context_create (NULL /* TO FIXE ***/, 
+                                             "datastore-mysql");
+
+     struct GNUNET_MYSQL_StatementHandle *statements_handle;
+     
+     statements_handle = GNUNET_MYSQL_statement_prepare (context,
+                                        "CREATE TABLE test_my("
+                                        "pub INT"
+                                        ", sig INT"
+                                        ", abs_time BIGINT"
+                                        ", forever BIGINT"
+                                        ", hash INT"
+                                        ", vsize VARCHAR"
+                                        ", u16 SMALLINT"
+                                        ", u32 INT"
+                                        ", u64 BIGINT"
+                                        ")");
+
+     //USE GNUNET_MY_exec_prepared
+     GNUNET_MY_exec_prepared(context,
+                              statements_handle,
+                              NULL);
+
+     if (GNUNET_OK != GNUNET_MYSQL_context_destroy (context))
+     {
+          //ERROR
+     }
+
+     return GNUNET_OK;
+
+/*  NEW VERSION TO FIXE   if (GNUNET_OK != 
+          mysql_prepare (&mysql))
+     {
+          GNUNET_break (0) ;
+          mysql_close (&mysql);
+          return 1;
+     }
+
+     int ret;
+     ret = run_queries (&mysql);
+
+     
+     if (mysql_query (&mysql, 
+                    "DROP TABLE test_my;"))
+     {
+          fprintf (stderr, "Failed to drop table : %s\n",
+                         mysql_error (&mysql));
+          mysql_close (&mysql);
+          return 1;
+     }
+
+*/
+/*  OLD VERSION (use SQL basic function)
+
+     ret = run_queries ();
+     
+     MYSQL mysql ;
+     MYSQL_RES *result;
+
+     int ret;
+
      char *hote = "";
      char *pseudo = "";
      char *mdp = "";
@@ -375,6 +438,4 @@
 
      return ret;
 */
-//     mysql_close (&mysql);
-//    return GNUNET_OK;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]