aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_pq_lib.h4
-rw-r--r--src/pq/test_pq.c14
-rw-r--r--src/util/crypto.c2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index 06ff580fe..d030d9b74 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -310,8 +310,8 @@ struct TALER_PQ_ResultSpec
*/
struct TALER_PQ_ResultSpec
TALER_PQ_result_spec_variable_size (const char *name,
- void **dst,
- size_t *sptr);
+ void **dst,
+ size_t *sptr);
/**
diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c
index 185b95ca1..ff89e29f3 100644
--- a/src/pq/test_pq.c
+++ b/src/pq/test_pq.c
@@ -60,9 +60,10 @@ postgres_prepare (PGconn *db_conn)
",namount_val"
",namount_frac"
",namount_curr"
+ ",vsize"
") VALUES "
"($1, $2, $3, $4, $5, $6,"
- "$7, $8, $9, $10, $11);",
+ "$7, $8, $9, $10, $11, $12);",
11, NULL);
PREPARE ("test_select",
"SELECT"
@@ -77,6 +78,7 @@ postgres_prepare (PGconn *db_conn)
",namount_val"
",namount_frac"
",namount_curr"
+ ",vsize"
" FROM test_pq"
" ORDER BY abs_time DESC "
" LIMIT 1;",
@@ -112,6 +114,8 @@ run_queries (PGconn *conn)
int ret;
struct GNUNET_CRYPTO_rsa_PrivateKey *priv;
char msg[] = "Hello";
+ void *msg2;
+ size_t msg2_len;
priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
@@ -134,6 +138,7 @@ run_queries (PGconn *conn)
TALER_PQ_query_param_auto_from_type (&hc),
TALER_PQ_query_param_amount (&hamount),
TALER_PQ_query_param_amount_nbo (&namount),
+ TALER_PQ_query_param_fixed_size (msg, strlen (msg)),
TALER_PQ_query_param_end
};
struct TALER_PQ_QueryParam params_select[] = {
@@ -147,6 +152,7 @@ run_queries (PGconn *conn)
TALER_PQ_result_spec_auto_from_type ("hash", &hc2),
TALER_PQ_result_spec_amount ("hamount", &hamount2),
TALER_PQ_result_spec_amount_nbo ("namount", &namount2),
+ TALER_PQ_result_spec_variable_size ("vsize", &msg2, &msg2_len),
TALER_PQ_result_spec_end
};
@@ -205,6 +211,11 @@ run_queries (PGconn *conn)
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));
TALER_PQ_cleanup_result (results_select);
PQclear (result);
@@ -254,6 +265,7 @@ main(int argc,
",namount_val INT8 NOT NULL"
",namount_frac INT4 NOT NULL"
",namount_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
+ ",vsize VARCHAR NOT NULL"
")");
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 8cd08af63..abc9fc5f8 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -49,7 +49,7 @@ fatal_error_handler (void *cls,
/**
* Initialize libgcrypt.
*/
-void
+void __attribute__ ((constructor))
TALER_gcrypt_init ()
{
gcry_set_fatalerror_handler (&fatal_error_handler,