static int
run_queries (struct GNUNET_MYSQL_Context *context)
{
- const struct GNUNET_CRYPTO_RsaPublicKey *pub;
+ 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 msg_len;
+// size_t msg2_len;
+
uint16_t u16;
+// uint16_t u162;
uint32_t u32;
+// uint32_t u322;
uint64_t u64;
+// uint64_t u642;
+
+ msg_len = sizeof(msg);
+
+// int ret;
struct GNUNET_MYSQL_StatementHandle *statements_handle_insert;
+
// struct GNUNET_MYSQL_StatementHandle *statements_handle_select;
struct GNUNET_CRYPTO_RsaPrivateKey *priv;
",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;
}
GNUNET_MY_query_param_end
};
- //FAIL HERE
- if (GNUNET_OK != GNUNET_MY_exec_prepared (context,
+ if (GNUNET_OK != GNUNET_MY_exec_prepared(context,
statements_handle_insert,
params_insert))
{
- fprintf (stderr, "Failed to execute prepared statement\n");
- return 22;
+ fprintf (stderr, "Failed to execute prepared statement INSERT\n");
+ return 1;
}
-/* statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
+
+
+
+/* statements_handle_select = GNUNET_MYSQL_statement_prepare (context,
"SELECT"
" pub"
",sig"
statements_handle_select,
params_select))
{
- fprintf (stderr, "Failed to execute prepared statement\n");
- return 22;
+ 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
+ };
+
+ ret = GNUNET_MY_extract_result (statements_handle_select,
+ NULL,
+ results_select,
+ 0);
+ if (GNUNET_OK != ret)
+ {
+ fprintf(stderr, "Failed to extract result\n");
+ return 1;
}
*/
return 0;
", sig INT NOT NULL"
", abs_time BIGINT NOT NULL"
", forever BIGINT NOT NULL"
- ", hash INT NOT NULL CHECK(LENGTH(hash)=64)"
+ ", hash VARCHAR(32) NOT NULL CHECK(LENGTH(hash)=64)"
", vsize VARCHAR(32) NOT NULL"
", u16 SMALLINT NOT NULL"
", u32 INT NOT NULL"
ret = run_queries (context);
- if(GNUNET_OK != GNUNET_MYSQL_statement_run (context,
+/* if(GNUNET_OK != GNUNET_MYSQL_statement_run (context,
"DROP TABLE test_my"))
{
fprintf (stderr, "Failed to drop table test_my\n");
GNUNET_MYSQL_statements_invalidate (context);
}
-
+*/
GNUNET_MYSQL_context_destroy (context);
return ret;