gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r37217 - in gnunet/src: include my
Date: Tue, 31 May 2016 15:44:31 +0200

Author: christophe.genevey
Date: 2016-05-31 15:44:31 +0200 (Tue, 31 May 2016)
New Revision: 37217

Modified:
   gnunet/src/include/gnunet_my_lib.h
   gnunet/src/my/my_query_helper.c
   gnunet/src/my/test_my.c
Log:
fixing query insert

Modified: gnunet/src/include/gnunet_my_lib.h
===================================================================
--- gnunet/src/include/gnunet_my_lib.h  2016-05-30 16:19:14 UTC (rev 37216)
+++ gnunet/src/include/gnunet_my_lib.h  2016-05-31 13:44:31 UTC (rev 37217)
@@ -251,7 +251,7 @@
 struct GNUNET_MY_QueryParam
 GNUNET_MY_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature 
*x);
 
-/**
+/**q
   * Generate query parameter for an absolute time value.
   * The database must store a 64-bit integer.
   *

Modified: gnunet/src/my/my_query_helper.c
===================================================================
--- gnunet/src/my/my_query_helper.c     2016-05-30 16:19:14 UTC (rev 37216)
+++ gnunet/src/my/my_query_helper.c     2016-05-31 13:44:31 UTC (rev 37217)
@@ -26,7 +26,6 @@
 #include <mysql/mysql.h>
 #include "gnunet_my_lib.h"
 
-
 /**
  * Function called to convert input argument into SQL parameters.
  *
@@ -41,11 +40,13 @@
                     MYSQL_BIND *qbind)
 {
   GNUNET_assert (1 == qp->num_params);
+
   qbind->buffer = (void *) qp->data;
   qbind->buffer_length = qp->data_len;
-  qbind->length = (unsigned long *) &qp->data_len;
   qbind->buffer_type = 1;
-  return 0;
+
+  //return 0;
+  return 1;
 }
 
 
@@ -99,10 +100,15 @@
   const uint16_t *u_hbo = qp->data;
   uint16_t *u_nbo;
 
+  fprintf(stderr, "input data : %u\n", (unsigned)u_hbo);
+  
   GNUNET_assert (1 == qp->num_params);
 
+
   u_nbo = GNUNET_new (uint16_t);
   *u_nbo = htons (*u_hbo);
+  
+  fprintf(stderr, "output data : %u\n", (unsigned)u_nbo);
   qbind->buffer = (void *) u_nbo;
   qbind->buffer_length = sizeof(uint16_t);
   qbind->buffer_type = 1;

Modified: gnunet/src/my/test_my.c
===================================================================
--- gnunet/src/my/test_my.c     2016-05-30 16:19:14 UTC (rev 37216)
+++ gnunet/src/my/test_my.c     2016-05-31 13:44:31 UTC (rev 37217)
@@ -47,8 +47,8 @@
      uint32_t u32;
      uint64_t u64;
 
-//     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;
@@ -62,7 +62,7 @@
      u32 = 32;
      u64 = 64;
 
-/*   FIXE THE INSERT QUERY  
+//   FIXE THE INSERT QUERY  
      statements_handle_insert = GNUNET_MYSQL_statement_prepare (context,
                                         "INSERT INTO test_my ("
                                         " pub"
@@ -75,15 +75,16 @@
                                         ",u32"
                                         ",u64"
                                         ") VALUES "
-                                        "(@1, @2, @3, @4, @5, @6,"
-                                        "@7, @8, @9);");
+                                        "(?, ?, ?, ?, ?, ?,"
+                                        "?, ?, ?)");
 
      if (NULL == statements_handle_insert)
      {
-          fprintf(stderr, "Failed to prepared statement INSERT\n");
+          fprintf (stderr, "Failed to prepared statement INSERT\n");
           return 1;
      }
 
+     //ERROR WITH MSG
      struct GNUNET_MY_QueryParam params_insert[] = {
           GNUNET_MY_query_param_rsa_public_key (pub),
           GNUNET_MY_query_param_rsa_signature (sig),
@@ -97,6 +98,9 @@
           GNUNET_MY_query_param_end
      };
 
+     fprintf(stderr, " u16 : %u\n", (unsigned)params_insert[6].data);
+     fprintf(stderr, " &u16 : %u\n", (unsigned)&u16);
+
       //FAIL HERE
      if (GNUNET_OK != GNUNET_MY_exec_prepared (context,
                                              statements_handle_insert,
@@ -106,7 +110,8 @@
                     "Failed to execute prepared statement\n");
           return 22;
      }
-*/
+
+/*   NOT THE GOOD FUNCTION -> TO FIXE 
      statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
                                                                  "SELECT"
                                                                  " pub"
@@ -139,7 +144,7 @@
           fprintf (stderr, "Failed to execute prepared statement\n");
           return 22;
      }
-
+*/
      return 0;
 }
 




reply via email to

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