fix DB logic: actually iterate where we need to
This commit is contained in:
parent
86665a7c9f
commit
81af01a209
@ -2648,13 +2648,16 @@ postgres_insert_refresh_commit_links (void *cls,
|
|||||||
uint16_t num_links,
|
uint16_t num_links,
|
||||||
const struct TALER_RefreshCommitLinkP *links)
|
const struct TALER_RefreshCommitLinkP *links)
|
||||||
{
|
{
|
||||||
// FIXME: check logic! links is array!
|
uint16_t i;
|
||||||
|
|
||||||
|
for (i=0;i<num_links;i++)
|
||||||
|
{
|
||||||
struct TALER_PQ_QueryParam params[] = {
|
struct TALER_PQ_QueryParam params[] = {
|
||||||
TALER_PQ_query_param_auto_from_type (session_hash),
|
TALER_PQ_query_param_auto_from_type (session_hash),
|
||||||
TALER_PQ_query_param_auto_from_type (&links->transfer_pub),
|
TALER_PQ_query_param_auto_from_type (&links[i].transfer_pub),
|
||||||
TALER_PQ_query_param_uint16 (&cnc_index),
|
TALER_PQ_query_param_uint16 (&cnc_index),
|
||||||
TALER_PQ_query_param_uint16 (&num_links),
|
TALER_PQ_query_param_uint16 (&i),
|
||||||
TALER_PQ_query_param_auto_from_type (&links->shared_secret_enc),
|
TALER_PQ_query_param_auto_from_type (&links[i].shared_secret_enc),
|
||||||
TALER_PQ_query_param_end
|
TALER_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2673,8 +2676,8 @@ postgres_insert_refresh_commit_links (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2701,11 +2704,14 @@ postgres_get_refresh_commit_links (void *cls,
|
|||||||
uint16_t num_links,
|
uint16_t num_links,
|
||||||
struct TALER_RefreshCommitLinkP *links)
|
struct TALER_RefreshCommitLinkP *links)
|
||||||
{
|
{
|
||||||
// FIXME: check logic: was written for a single link!
|
uint16_t i;
|
||||||
|
|
||||||
|
for (i=0;i<num_links;i++)
|
||||||
|
{
|
||||||
struct TALER_PQ_QueryParam params[] = {
|
struct TALER_PQ_QueryParam params[] = {
|
||||||
TALER_PQ_query_param_auto_from_type (session_hash),
|
TALER_PQ_query_param_auto_from_type (session_hash),
|
||||||
TALER_PQ_query_param_uint16 (&cnc_index),
|
TALER_PQ_query_param_uint16 (&cnc_index),
|
||||||
TALER_PQ_query_param_uint16 (&num_links),
|
TALER_PQ_query_param_uint16 (&i),
|
||||||
TALER_PQ_query_param_end
|
TALER_PQ_query_param_end
|
||||||
};
|
};
|
||||||
PGresult *result;
|
PGresult *result;
|
||||||
@ -2727,9 +2733,9 @@ postgres_get_refresh_commit_links (void *cls,
|
|||||||
{
|
{
|
||||||
struct TALER_PQ_ResultSpec rs[] = {
|
struct TALER_PQ_ResultSpec rs[] = {
|
||||||
TALER_PQ_result_spec_auto_from_type ("transfer_pub",
|
TALER_PQ_result_spec_auto_from_type ("transfer_pub",
|
||||||
&links->transfer_pub),
|
&links[i].transfer_pub),
|
||||||
TALER_PQ_result_spec_auto_from_type ("link_secret_enc",
|
TALER_PQ_result_spec_auto_from_type ("link_secret_enc",
|
||||||
&links->shared_secret_enc),
|
&links[i].shared_secret_enc),
|
||||||
TALER_PQ_result_spec_end
|
TALER_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2741,6 +2747,7 @@ postgres_get_refresh_commit_links (void *cls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user