gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r37252 - in gnunet/src: include my
Date: Tue, 7 Jun 2016 15:50:09 +0200

Author: christophe.genevey
Date: 2016-06-07 15:50:08 +0200 (Tue, 07 Jun 2016)
New Revision: 37252

Modified:
   gnunet/src/include/gnunet_my_lib.h
   gnunet/src/my/my.c
   gnunet/src/my/my_query_helper.c
   gnunet/src/my/my_result_helper.c
   gnunet/src/my/test_my.c
Log:
written function cleanup

Modified: gnunet/src/include/gnunet_my_lib.h
===================================================================
--- gnunet/src/include/gnunet_my_lib.h  2016-06-07 12:55:00 UTC (rev 37251)
+++ gnunet/src/include/gnunet_my_lib.h  2016-06-07 13:50:08 UTC (rev 37252)
@@ -66,9 +66,20 @@
 
 
 /**
+ * Function called to cleanup result data.
+ *
+ * @param cls closure
+ * @param rs spec to clean up
+ */
+typedef void
+(*GNUNET_MY_QueryCleanup)(void *cls,
+                           struct GNUNET_MY_QueryParam *qp);
+/**
  * Information we pass to #GNUNET_MY_exec_prepared() to
  * initialize the arguments of the prepared statement.
  */
+
+
 struct GNUNET_MY_QueryParam
 {
 
@@ -77,6 +88,11 @@
    */
   GNUNET_MY_QueryConverter conv;
 
+   /**
+   * Function to call for cleaning up the query. Can be NULL.
+   */
+  GNUNET_MY_QueryCleanup cleaner;
+
   /**
    * Closure for @e conv.
    */
@@ -104,7 +120,7 @@
  *
  * @return array last entry for the result specification to use
  */
-#define GNUNET_MY_query_param_end { NULL, NULL, 0, NULL, 0 }
+#define GNUNET_MY_query_param_end { NULL, NULL, NULL, 0, NULL, 0 }
 
 
 
@@ -447,7 +463,16 @@
                           struct GNUNET_MY_ResultSpec *specs);
 
 
+/**
+ * Free all memory that was allocated in @a qp during
+ * #GNUNET_MY_exect_prepared().
+ *
+ * @param qp query specification to clean up
+ */
+void
+GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp);
 
+
 /**
  * Free all memory that was allocated in @a rs during
  * #GNUNET_MY_extract_result().

Modified: gnunet/src/my/my.c
===================================================================
--- gnunet/src/my/my.c  2016-06-07 12:55:00 UTC (rev 37251)
+++ gnunet/src/my/my.c  2016-06-07 13:50:08 UTC (rev 37252)
@@ -65,6 +65,10 @@
                    p,
                    &qbind[off]))
       {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Conversion for MySQL query failed at offset %u\n",
+                    i);
+        GNUNET_MY_cleanup_query (params);
         return GNUNET_SYSERR;
       }
       off += p->num_params;
@@ -88,6 +92,7 @@
                        "mysql_stmt_execute", __FILE__, __LINE__,
                        mysql_stmt_error (stmt));
       GNUNET_MYSQL_statements_invalidate (mc);
+      GNUNET_MY_cleanup_query (params);
       return GNUNET_SYSERR;
     }
   }
@@ -97,6 +102,23 @@
 
 
 /**
+ * Free all memory that was allocated in @a qp during
+ * #GNUNET_MY_exect_prepared().
+ *
+ * @param qp query specification to clean up
+ */
+void
+GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp)
+{
+  unsigned int i;
+
+  for (i=0;NULL != qp[i].cleaner;i++)
+    qp[i].cleaner (qp[i].conv_cls,
+                   &qp[i]);
+}
+
+
+/**
  * Extract results from a query result according to the given
  * specification.  Always fetches the next row.
  *

Modified: gnunet/src/my/my_query_helper.c
===================================================================
--- gnunet/src/my/my_query_helper.c     2016-06-07 12:55:00 UTC (rev 37251)
+++ gnunet/src/my/my_query_helper.c     2016-06-07 13:50:08 UTC (rev 37252)
@@ -62,6 +62,7 @@
 {
   struct GNUNET_MY_QueryParam qp = {
     .conv = &my_conv_fixed_size,
+    .cleaner = NULL,
     .conv_cls = NULL,
     .num_params = 1,
     .data = ptr,
@@ -106,7 +107,6 @@
   if (NULL == u_nbo)
     return -1;
 
-//  *u_nbo = htons (*u_hbo);
     *u_nbo = *u_hbo;
 
   qbind->buffer = (void *) u_nbo;
@@ -126,6 +126,7 @@
 {
   struct GNUNET_MY_QueryParam res = {
       .conv = &my_conv_uint16,
+      .cleaner = NULL,
       .conv_cls = NULL,
       .num_params = 1,
       .data = x,
@@ -174,6 +175,7 @@
 {
   struct GNUNET_MY_QueryParam res = {
     .conv = &my_conv_uint32,
+    .cleaner = NULL,
     .conv_cls = NULL,
     .num_params = 1,
     .data = x,
@@ -222,6 +224,7 @@
 {
   struct GNUNET_MY_QueryParam res = {
     .conv = &my_conv_uint64,
+    .cleaner = NULL,
     .conv_cls = NULL,
     .num_params = 1,
     .data = x,
@@ -260,6 +263,27 @@
   }
 
 
+/**
+ * Function called to clean up memory allocated
+ * by a #GNUNET_MY_ResultConverter.
+ *
+ * @param cls closure
+ * @param rd result data to clean up
+ */
+static void
+my_clean_rsa_public_key (void *cls,
+                      struct GNUNET_MY_QueryParam *qp)
+{
+  struct GNUNET_CRYPTO_RsaPublicKey **pk = qp->data;
+
+  if (NULL != *pk)
+  {
+    GNUNET_CRYPTO_rsa_public_key_free (*pk);
+    *pk = NULL;
+  }
+}
+
+
   /**
     * Generate query parameter for an RSA public key. The
     * database must contain a BLOB type in the respective position.
@@ -272,6 +296,7 @@
 {
   struct GNUNET_MY_QueryParam res = {
     .conv = &my_conv_rsa_public_key,
+    .cleaner = &my_clean_rsa_public_key,
     .conv_cls = NULL,
     .num_params = 1,
     .data = x,
@@ -312,6 +337,27 @@
 
 
 /**
+ * Function called to clean up memory allocated
+ * by a #GNUNET_MY_QueryConverter.
+ *
+ * @param cls closure
+ * @param rd result data to clean up
+ */
+static void
+my_clean_rsa_signature (void *cls,
+          struct GNUNET_MY_QueryParam *qp)
+{
+  struct GNUNET_CRYPTO_RsaSignature **sig = qp->data;
+
+  if (NULL != *sig)
+  {
+    GNUNET_CRYPTO_rsa_signature_free (*sig);
+    *sig = NULL;
+  }
+}
+
+
+/**
   * Generate query parameter for an RSA signature. The
   * database must contain a BLOB type in the respective position
   *
@@ -323,6 +369,7 @@
 {
   struct GNUNET_MY_QueryParam res = {
     .conv = &my_conv_rsa_signature,
+    .cleaner = &my_clean_rsa_signature,
     .conv_cls = NULL,
     .num_params = 1,
     .data = (x),

Modified: gnunet/src/my/my_result_helper.c
===================================================================
--- gnunet/src/my/my_result_helper.c    2016-06-07 12:55:00 UTC (rev 37251)
+++ gnunet/src/my/my_result_helper.c    2016-06-07 13:50:08 UTC (rev 37252)
@@ -43,7 +43,6 @@
   results[0].buffer = NULL;
   results[0].buffer_length = 0;
   results[0].length = &rs->mysql_bind_output_length;
- // results[0].buffer_type = MYSQL_TYPE_BLOB;
 
   return GNUNET_OK;
 }

Modified: gnunet/src/my/test_my.c
===================================================================
--- gnunet/src/my/test_my.c     2016-06-07 12:55:00 UTC (rev 37251)
+++ gnunet/src/my/test_my.c     2016-06-07 13:50:08 UTC (rev 37252)
@@ -38,44 +38,44 @@
 run_queries (struct GNUNET_MYSQL_Context *context)
 {
   struct GNUNET_CRYPTO_RsaPublicKey *pub;
-     struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL;
-     struct GNUNET_CRYPTO_RsaSignature *sig;
-     struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL;
-     struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get ();
-     struct GNUNET_TIME_Absolute abs_time2;
-     struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS;
-     struct GNUNET_TIME_Absolute forever2;
-     struct GNUNET_HashCode hc;
-     struct GNUNET_HashCode hc2;
-     const char msg[] = "hello";
-     void *msg2;
-     size_t msg2_len;
+  struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL;
+  struct GNUNET_CRYPTO_RsaSignature *sig;
+  struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL;
+  struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get ();
+  struct GNUNET_TIME_Absolute abs_time2;
+  struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS;
+  struct GNUNET_TIME_Absolute forever2;
+  struct GNUNET_HashCode hc;
+  struct GNUNET_HashCode hc2;
+  const char msg[] = "hello";
+  void *msg2;
+  size_t msg2_len;
 
-     uint16_t u16;
-     uint16_t u162;
-     uint32_t u32;
-     uint32_t u322;
-     uint64_t u64;
-     uint64_t u642;
+  uint16_t u16;
+  uint16_t u162;
+  uint32_t u32;
+  uint32_t u322;
+  uint64_t u64;
+  uint64_t u642;
 
-     int ret;
+  int ret;
 
-     struct GNUNET_MYSQL_StatementHandle *statements_handle_insert;
-     struct GNUNET_MYSQL_StatementHandle *statements_handle_select;
+  struct GNUNET_MYSQL_StatementHandle *statements_handle_insert;
+  struct GNUNET_MYSQL_StatementHandle *statements_handle_select;
 
-     struct GNUNET_CRYPTO_RsaPrivateKey *priv;
-     struct GNUNET_HashCode hmsg;
+  struct GNUNET_CRYPTO_RsaPrivateKey *priv;
+  struct GNUNET_HashCode hmsg;
 
-     priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
-     pub =  GNUNET_CRYPTO_rsa_private_key_get_public (priv);
-     memset (&hmsg, 42, sizeof(hmsg));
-     sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
+  priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
+  pub =  GNUNET_CRYPTO_rsa_private_key_get_public (priv);
+  memset (&hmsg, 42, sizeof(hmsg));
+  sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
                                         &hmsg);
-     u16 = 16;
-     u32 = 32;
-     u64 = 64;
+  u16 = 16;
+  u32 = 32;
+  u64 = 64;
 
-     statements_handle_insert = GNUNET_MYSQL_statement_prepare (context,
+  statements_handle_insert = GNUNET_MYSQL_statement_prepare (context,
                                         "INSERT INTO test_my2 ("
                                         " pub"
                                         ",sig"
@@ -89,158 +89,114 @@
                                         ") VALUES "
                                         "( ?, ?, ?, ?, ?, ?, ?, ?, ?)");
 
-     if (NULL == statements_handle_insert)
-     {
-          fprintf (stderr, "Failed to prepared statement INSERT\n");
-          return 1;
-     }
+  if (NULL == statements_handle_insert)
+  {
+    fprintf (stderr, "Failed to prepared statement INSERT\n");
+     return 1;
+  }
 
-     struct GNUNET_MY_QueryParam params_insert[] = {
-          GNUNET_MY_query_param_rsa_public_key (pub),
-          GNUNET_MY_query_param_rsa_signature (sig),
-          GNUNET_MY_query_param_absolute_time (&abs_time),
-          GNUNET_MY_query_param_absolute_time (&forever),
-          GNUNET_MY_query_param_auto_from_type (&hc),
-          GNUNET_MY_query_param_fixed_size (msg, strlen (msg)),
-          GNUNET_MY_query_param_uint16 (&u16),
-          GNUNET_MY_query_param_uint32 (&u32),
-          GNUNET_MY_query_param_uint64 (&u64),
-          GNUNET_MY_query_param_end
-     };
+  struct GNUNET_MY_QueryParam params_insert[] = {
+    GNUNET_MY_query_param_rsa_public_key (pub),
+    GNUNET_MY_query_param_rsa_signature (sig),
+    GNUNET_MY_query_param_absolute_time (&abs_time),
+    GNUNET_MY_query_param_absolute_time (&forever),
+    GNUNET_MY_query_param_auto_from_type (&hc),
+    GNUNET_MY_query_param_fixed_size (msg, strlen (msg)),
+    GNUNET_MY_query_param_uint16 (&u16),
+    GNUNET_MY_query_param_uint32 (&u32),
+    GNUNET_MY_query_param_uint64 (&u64),
+    GNUNET_MY_query_param_end
+  };
 
- /*    statements_handle_insert = GNUNET_MYSQL_statement_prepare (context,
-                                        "INSERT INTO test_my2 ("
-                                        " abs_time"
-                                        ",forever"
-                                        ",hash"
-                                        ",u16"
-                                        ",u32"
-                                        ",u64"
-                                        ") VALUES "
-                                        "( ?, ?, ?, ?, ?, ?)");
+  if (GNUNET_OK != GNUNET_MY_exec_prepared(context,
+                                          statements_handle_insert,
+                                          params_insert))
+  {
+      fprintf (stderr, "Failed to execute prepared statement INSERT\n");
+      return 1;
+  }
 
-      struct GNUNET_MY_QueryParam params_insert[] = {
-          GNUNET_MY_query_param_absolute_time (&abs_time),
-          GNUNET_MY_query_param_absolute_time (&forever),
-          GNUNET_MY_query_param_auto_from_type (&hc),
-          GNUNET_MY_query_param_uint16 (&u16),
-          GNUNET_MY_query_param_uint32 (&u32),
-          GNUNET_MY_query_param_uint64 (&u64),
-          GNUNET_MY_query_param_end
-     };
-*/
-     if (GNUNET_OK != GNUNET_MY_exec_prepared(context,
-                                             statements_handle_insert,
-                                             params_insert))
-     {
-          fprintf (stderr, "Failed to execute prepared statement INSERT\n");
-          return 1;
-     }
+  statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
+                                                              "SELECT"
+                                                              " pub"
+                                                              ",sig"
+                                                              ",abs_time"
+                                                              ",forever"
+                                                              ",hash"
+                                                              ",vsize"
+                                                              ",u16"
+                                                              ",u32"
+                                                              ",u64"
+                                                              " FROM 
test_my2");
 
+  if (NULL == statements_handle_select)
+  {
+    fprintf(stderr, "Failed to prepared statement SELECT\n");
+    return 1;
+  }
 
+  struct GNUNET_MY_QueryParam params_select[] = {
+        GNUNET_MY_query_param_end
+  };
 
-/*   statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
-                                                                 "SELECT"
-                                                                 " pub"
-                                                                 ",sig"
-                                                                 ",abs_time"
-                                                                 ",forever"
-                                                                 ",hash"
-                                                                 ",vsize"
-                                                                 ",u16"
-                                                                 ",u32"
-                                                                 ",u64"
-                                                                 " FROM 
test_my"
-                                                                 " ORDER BY 
abs_time DESC "
-                                                                 " LIMIT 1;");
-
-*/
-     statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
-                                                                 "SELECT"
-                                                                 " pub"
-                                                                 ",sig"
-                                                                 ",abs_time"
-                                                                 ",forever"
-                                                                 ",hash"
-                                                                 ",vsize"
-                                                                 ",u16"
-                                                                 ",u32"
-                                                                 ",u64"
-                                                                 " FROM 
test_my2");
-
-     if (NULL == statements_handle_select)
-     {
-          fprintf(stderr, "Failed to prepared statement SELECT\n");
-          return 1;
-     }
-
-     struct GNUNET_MY_QueryParam params_select[] = {
-          GNUNET_MY_query_param_end
-     };
-
-     if (GNUNET_OK != GNUNET_MY_exec_prepared (context,
-                                             statements_handle_select,
-                                             params_select))
-     {
+  if (GNUNET_OK != GNUNET_MY_exec_prepared (context,
+                                            statements_handle_select,
+                                            params_select))
+  {
           fprintf (stderr, "Failed to execute prepared statement SELECT\n");
           return 1;
-     }
+  }
 
-/*
-     struct GNUNET_MY_ResultSpec results_select[] = {
-          GNUNET_MY_result_spec_rsa_public_key (&pub2),
-          GNUNET_MY_result_spec_rsa_signature (&sig2),
-          GNUNET_MY_result_spec_absolute_time (&abs_time2),
-          GNUNET_MY_result_spec_absolute_time (&forever2),
-          GNUNET_MY_result_spec_auto_from_type (&hc2),
-          GNUNET_MY_result_spec_variable_size (&msg2, &msg2_len),
-          GNUNET_MY_result_spec_uint16 (&u162),
-          GNUNET_MY_result_spec_uint32 (&u322),
-          GNUNET_MY_result_spec_uint64 (&u642),
-          GNUNET_MY_result_spec_end
-     };
-*/
-     struct GNUNET_MY_ResultSpec results_select[] = {
-          GNUNET_MY_result_spec_rsa_public_key (&pub2),
-          GNUNET_MY_result_spec_rsa_signature (&sig2),
-          GNUNET_MY_result_spec_absolute_time (&abs_time2),
-          GNUNET_MY_result_spec_absolute_time (&forever2),
-          GNUNET_MY_result_spec_auto_from_type (&hc2),
-          GNUNET_MY_result_spec_variable_size (&msg2, &msg2_len),
-          GNUNET_MY_result_spec_uint16 (&u162),
-          GNUNET_MY_result_spec_uint32 (&u322),
-          GNUNET_MY_result_spec_uint64 (&u642),
-          GNUNET_MY_result_spec_end
-     };
+  struct GNUNET_MY_ResultSpec results_select[] = {
+        GNUNET_MY_result_spec_rsa_public_key (&pub2),
+        GNUNET_MY_result_spec_rsa_signature (&sig2),
+        GNUNET_MY_result_spec_absolute_time (&abs_time2),
+        GNUNET_MY_result_spec_absolute_time (&forever2),
+        GNUNET_MY_result_spec_auto_from_type (&hc2),
+        GNUNET_MY_result_spec_variable_size (&msg2, &msg2_len),
+        GNUNET_MY_result_spec_uint16 (&u162),
+        GNUNET_MY_result_spec_uint32 (&u322),
+        GNUNET_MY_result_spec_uint64 (&u642),
+        GNUNET_MY_result_spec_end
+  };
 
-     ret = GNUNET_MY_extract_result (statements_handle_select,
-                                     results_select);
+  ret = GNUNET_MY_extract_result (statements_handle_select,
+                                  results_select);
 
-     GNUNET_break (GNUNET_YES == ret);
-     GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us);
-     GNUNET_break (forever.abs_value_us == forever2.abs_value_us);
-     GNUNET_break (0 ==
-                    memcmp (&hc,
+  GNUNET_break (GNUNET_YES == ret);
+  GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us);
+  GNUNET_break (forever.abs_value_us == forever2.abs_value_us);
+  GNUNET_break (0 ==
+                  memcmp (&hc,
                             &hc2,
                             sizeof (struct GNUNET_HashCode)));
 
-     GNUNET_break (strlen (msg) == msg2_len);
-     GNUNET_break (0 ==
+  GNUNET_break (0 ==
+            GNUNET_CRYPTO_rsa_signature_cmp (sig,
+                                 sig2));
+  GNUNET_break (0 ==
+            GNUNET_CRYPTO_rsa_public_key_cmp (pub,
+                                  pub2));
+
+  GNUNET_break (strlen (msg) == msg2_len);
+  GNUNET_break (0 ==
             strncmp (msg,
                   msg2,
                   msg2_len));
-     fprintf(stderr, "msg2 : %d\n", strlen(msg2));
-     GNUNET_break (16 == u162);
-     GNUNET_break (32 == u322);
-     GNUNET_break (64 == u642);
+  GNUNET_break (16 == u162);
+  GNUNET_break (32 == u322);
+  GNUNET_break (64 == u642);
 
-     if (GNUNET_OK != ret)
-     {
-          fprintf(stderr, "Failed to extract result\n");
-          return 1;
-     }
+  GNUNET_MY_cleanup_result (results_select);
 
-     return 0;
+  GNUNET_CRYPTO_rsa_signature_free (sig);
+  GNUNET_CRYPTO_rsa_private_key_free (priv);
+  GNUNET_CRYPTO_rsa_public_key_free (pub);     
+     
+  if (GNUNET_OK != ret)
+      return 1;
+
+  return 0;
 }
 
 
@@ -247,32 +203,32 @@
 int
 main (int argc, const char * const argv[])
 {
-     struct GNUNET_CONFIGURATION_Handle *config;
-     struct GNUNET_MYSQL_Context *context;
-     int ret;
+  struct GNUNET_CONFIGURATION_Handle *config;
+  struct GNUNET_MYSQL_Context *context;
+  int ret;
 
-     GNUNET_log_setup (  "test-my",
+  GNUNET_log_setup (  "test-my",
                          "WARNING",
                          NULL);
 
-     config = GNUNET_CONFIGURATION_create ();
-     if (GNUNET_OK != GNUNET_CONFIGURATION_parse (config, "test_my.conf"))
-     {
-          fprintf (stderr, "Failed to parse configuaration\n");
-          return 1;
-     }
+  config = GNUNET_CONFIGURATION_create ();
+  if (GNUNET_OK != GNUNET_CONFIGURATION_parse (config, "test_my.conf"))
+  {
+      fprintf (stderr, "Failed to parse configuaration\n");
+      return 1;
+  }
 
-     context = GNUNET_MYSQL_context_create (config,
+  context = GNUNET_MYSQL_context_create (config,
                                              "datastore-mysql");
-     if (NULL == context)
-     {
-          fprintf(stderr, "Failed to connect to database\n");
-          return 77;
-     }
+  if (NULL == context)
+  {
+      fprintf(stderr, "Failed to connect to database\n");
+      return 77;
+  }
 
-     (void) GNUNET_MYSQL_statement_run (context,
+  (void) GNUNET_MYSQL_statement_run (context,
                                         "DROP TABLE test_my2;");
-     if (GNUNET_OK != GNUNET_MYSQL_statement_run (context,
+  if (GNUNET_OK != GNUNET_MYSQL_statement_run (context,
                                                   "CREATE TABLE IF NOT EXISTS 
test_my2("
                                                   " pub BLOB NOT NULL"
                                                   ",sig BLOB NOT NULL"
@@ -284,43 +240,16 @@
                                                   ",u32 INT NOT NULL"
                                                   ",u64 BIGINT NOT NULL"
                                                   ")"))
-     {
-          fprintf (stderr,
-                    "Failed to create table \n");
-          GNUNET_MYSQL_statements_invalidate (context);
-          GNUNET_MYSQL_context_destroy (context);
+  {
+      fprintf (stderr,
+                "Failed to create table \n");
+      GNUNET_MYSQL_statements_invalidate (context);
+      GNUNET_MYSQL_context_destroy (context);
 
-          return 1;
-     }
+      return 1;
+  }
 
-/*     if (GNUNET_OK != GNUNET_MYSQL_statement_run (context,
-                                                  "CREATE TABLE test_my2("
-                                                  " abs_time BIGINT NOT NULL"
-                                                  ", forever BIGINT NOT NULL"
-                                                  ", hash VARCHAR(32) NOT NULL 
CHECK(LENGTH(hash)=64)"
-                                                  ", u16 SMALLINT NOT NULL"
-                                                  ", u32 INT NOT NULL"
-                                                  ", u64 BIGINT NOT NULL"
-                                                  ")"))
-     {
-          fprintf (stderr,
-                    "Failed to create table \n");
-          GNUNET_MYSQL_statements_invalidate (context);
-          GNUNET_MYSQL_context_destroy (context);
+  ret = run_queries (context);
 
-          return 1;
-     }
-*/
-     ret = run_queries (context);
-
-/*     if(GNUNET_OK != GNUNET_MYSQL_statement_run (context,
-                                                  "DROP TABLE test_my2"))
-     {
-          fprintf (stderr, "Failed to drop table test_my\n");
-          GNUNET_MYSQL_statements_invalidate (context);
-     }
-
-     GNUNET_MYSQL_context_destroy (context);
-*/
-     return ret;
+  return ret;
 }




reply via email to

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