fix exchangedb build errors

This commit is contained in:
Christian Grothoff 2023-03-31 13:50:32 +02:00
parent 9cce35d270
commit 6eed8917c3
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
158 changed files with 696 additions and 750 deletions

View File

@ -116,6 +116,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
pg_reserves_in_insert.h pg_reserves_in_insert.c \ pg_reserves_in_insert.h pg_reserves_in_insert.c \
pg_get_withdraw_info.h pg_get_withdraw_info.c \ pg_get_withdraw_info.h pg_get_withdraw_info.c \
pg_get_age_withdraw_info.c pg_get_age_withdraw_info.h \ pg_get_age_withdraw_info.c pg_get_age_withdraw_info.h \
pg_batch_ensure_coin_known.h pg_batch_ensure_coin_known.c \
pg_do_batch_withdraw.h pg_do_batch_withdraw.c \ pg_do_batch_withdraw.h pg_do_batch_withdraw.c \
pg_get_policy_details.h pg_get_policy_details.c \ pg_get_policy_details.h pg_get_policy_details.c \
pg_persist_policy_details.h pg_persist_policy_details.c \ pg_persist_policy_details.h pg_persist_policy_details.c \

View File

@ -36,7 +36,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_abort_shard (void *cls, TEH_PG_abort_shard (void *cls,
const char *job_name, const char *job_name,
uint64_t start_row, uint64_t start_row,
uint64_t end_row); uint64_t end_row);
#endif #endif

View File

@ -56,8 +56,8 @@ TEH_PG_add_denomination_key (
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TALER_denom_fee_check_currency (meta->value.currency, TALER_denom_fee_check_currency (meta->value.currency,
&meta->fees)); &meta->fees));
/* Used in #postgres_insert_denomination_info() and /* Used in #postgres_insert_denomination_info() and
#postgres_add_denomination_key() */ #postgres_add_denomination_key() */
PREPARE (pg, PREPARE (pg,
"denomination_insert", "denomination_insert",
"INSERT INTO denominations " "INSERT INTO denominations "
@ -86,4 +86,3 @@ TEH_PG_add_denomination_key (
"denomination_insert", "denomination_insert",
iparams); iparams);
} }

View File

@ -94,7 +94,7 @@ TEH_PG_add_policy_fulfillment_proof (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"insert_proof_into_policy_fulfillments", "insert_proof_into_policy_fulfillments",
params, params,

View File

@ -26,14 +26,10 @@
#include "pg_helper.h" #include "pg_helper.h"
static enum GNUNET_DB_QueryStatus
insert1 (struct PostgresClosure *pg,
const struct TALER_CoinPublicInfo coin[1],
struct TALER_EXCHANGEDB_CoinInfo result[1])
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert1 (struct PosgresClosure *pg,
const struct TALER_CoinPublicInfo *coin[1],
const struct TALER_EXCHANGEDB_CoinInfo *result[1])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
@ -57,16 +53,16 @@ insert1 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -79,47 +75,47 @@ insert1 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (&denom_hash->hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin->denom_pub_hash.hash)) ) &coin->denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment, (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin->h_age_commitment)) ) &coin->h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment)); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
return TALER_EXCHANGEDB_CKS_PRESENT; return qs;
} }
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert2 (struct PosgresClosure *pg, static enum GNUNET_DB_QueryStatus
const struct TALER_CoinPublicInfo *coin[2], insert2 (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_CoinInfo *result[2]) const struct TALER_CoinPublicInfo coin[2],
struct TALER_EXCHANGEDB_CoinInfo result[2])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
bool is_age_hash_null = false; bool is_age_hash_null = false;
bool is_denom_pub_hash_null2 = false; bool is_denom_pub_hash_null2 = false;
bool is_age_hash_null2 = false; bool is_age_hash_null2 = false;
PREPARE (pg, PREPARE (pg,
"batch2_known_coin", "batch2_known_coin",
"SELECT" "SELECT"
@ -148,21 +144,21 @@ insert2 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment[0]), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_bool ("existed2", GNUNET_PQ_result_spec_bool ("existed2",
result[1].existed), &result[1].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id2", GNUNET_PQ_result_spec_uint64 ("known_coin_id2",
result[1].known_coin_id), &result[1].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2",
&result[1].denom_hash), &result[1].denom_hash),
@ -182,57 +178,56 @@ insert2 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (&denom_hash[0].hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin[0].denom_pub_hash.hash)) ) &coin[0].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[0], (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin[0].h_age_commitment)) ) &coin[0].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[0])); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null2) && if ( (! is_denom_pub_hash_null2) &&
(0 != GNUNET_memcmp (&denom_hash[1].hash, (0 != GNUNET_memcmp (&result[1].denom_hash,
&coin[1].denom_pub_hash.hash)) ) &coin[1].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[1].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[1], (0 != GNUNET_memcmp (&result[1].h_age_commitment,
&coin[1].h_age_commitment)) ) &coin[1].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[1])); GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[1].age_conflict = true;
} }
return TALER_EXCHANGEDB_CKS_PRESENT; return qs;
} }
static enum TALER_EXCHANGEDB_CoinKnownStatus
insert4 (struct PosgresClosure *pg, static enum GNUNET_DB_QueryStatus
const struct TALER_CoinPublicInfo *coin[4], insert4 (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_CoinInfo *result[4]) const struct TALER_CoinPublicInfo coin[4],
struct TALER_EXCHANGEDB_CoinInfo result[4])
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false; bool is_denom_pub_hash_null = false;
@ -289,52 +284,52 @@ insert4 (struct PosgresClosure *pg,
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_bool ("existed", GNUNET_PQ_result_spec_bool ("existed",
result[0].existed), &result[0].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id", GNUNET_PQ_result_spec_uint64 ("known_coin_id",
result[0].known_coin_id), &result[0].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
result[0].denom_hash), &result[0].denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
result[0].h_age_commitment), &result[0].h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_bool ("existed2", GNUNET_PQ_result_spec_bool ("existed2",
result[1].existed), &result[1].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id2", GNUNET_PQ_result_spec_uint64 ("known_coin_id2",
result[1].known_coin_id), &result[1].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash2",
result[1].denom_hash), &result[1].denom_hash),
&is_denom_pub_hash_null2), &is_denom_pub_hash_null2),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash2", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash2",
result[1].h_age_commitment), &result[1].h_age_commitment),
&is_age_hash_null2), &is_age_hash_null2),
GNUNET_PQ_result_spec_bool ("existed3", GNUNET_PQ_result_spec_bool ("existed3",
result[2].existed), &result[2].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id3", GNUNET_PQ_result_spec_uint64 ("known_coin_id3",
result[2].known_coin_id), &result[2].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash3", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash3",
result[2].denom_hash), &result[2].denom_hash),
&is_denom_pub_hash_null3), &is_denom_pub_hash_null3),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash3", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash3",
result[2].h_age_commitment), &result[2].h_age_commitment),
&is_age_hash_null3), &is_age_hash_null3),
GNUNET_PQ_result_spec_bool ("existed4", GNUNET_PQ_result_spec_bool ("existed4",
result[3].existed), &result[3].existed),
GNUNET_PQ_result_spec_uint64 ("known_coin_id4", GNUNET_PQ_result_spec_uint64 ("known_coin_id4",
result[3].known_coin_id), &result[3].known_coin_id),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash4", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash4",
result[3].denom_hash), &result[3].denom_hash),
&is_denom_pub_hash_null4), &is_denom_pub_hash_null4),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash4", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash4",
result[3].h_age_commitment), &result[3].h_age_commitment),
&is_age_hash_null4), &is_age_hash_null4),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -347,113 +342,105 @@ insert4 (struct PosgresClosure *pg,
{ {
case GNUNET_DB_STATUS_HARD_ERROR: case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0); GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return qs;
case GNUNET_DB_STATUS_SOFT_ERROR: case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_EXCHANGEDB_CKS_SOFT_FAIL; return qs;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0); /* should be impossible */ GNUNET_break (0); /* should be impossible */
return TALER_EXCHANGEDB_CKS_HARD_FAIL; return GNUNET_DB_STATUS_HARD_ERROR;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
if (! existed)
return TALER_EXCHANGEDB_CKS_ADDED;
break; /* continued below */ break; /* continued below */
} }
if ( (! is_denom_pub_hash_null) && if ( (! is_denom_pub_hash_null) &&
(0 != GNUNET_memcmp (result[0].denom_hash.hash, (0 != GNUNET_memcmp (&result[0].denom_hash,
&coin[0].denom_pub_hash.hash)) ) &coin[0].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[0].denom_conflict = true;
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (h_age_commitment[0], (0 != GNUNET_memcmp (&result[0].h_age_commitment,
&coin[0].h_age_commitment)) ) &coin[0].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[0])); GNUNET_break (GNUNET_is_zero (&result[0].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[0].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null2) && if ( (! is_denom_pub_hash_null2) &&
(0 != GNUNET_memcmp (&denom_hash[1].hash, (0 != GNUNET_memcmp (&result[1].denom_hash,
&coin[1].denom_pub_hash.hash)) ) &coin[1].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[1].denom_conflict = true;
} }
if ( (! is_age_hash_null2) && if ( (! is_age_hash_null2) &&
(0 != GNUNET_memcmp (h_age_commitment[1], (0 != GNUNET_memcmp (&result[1].h_age_commitment,
&coin[1].h_age_commitment)) ) &coin[1].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[1])); GNUNET_break (GNUNET_is_zero (&result[1].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[1].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null3) && if ( (! is_denom_pub_hash_null3) &&
(0 != GNUNET_memcmp (&denom_hash[2].hash, (0 != GNUNET_memcmp (&result[2].denom_hash,
&coin[2].denom_pub_hash.hash)) ) &coin[2].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[2].denom_conflict = true;
} }
if ( (! is_age_hash_null3) && if ( (! is_age_hash_null3) &&
(0 != GNUNET_memcmp (h_age_commitment[2], (0 != GNUNET_memcmp (&result[2].h_age_commitment,
&coin[2].h_age_commitment)) ) &coin[2].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[2])); GNUNET_break (GNUNET_is_zero (&result[2].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[2].age_conflict = true;
} }
if ( (! is_denom_pub_hash_null4) && if ( (! is_denom_pub_hash_null4) &&
(0 != GNUNET_memcmp (&denom_hash[3].hash, (0 != GNUNET_memcmp (&result[3].denom_hash,
&coin[3].denom_pub_hash.hash)) ) &coin[3].denom_pub_hash)) )
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_DENOM_CONFLICT; result[3].denom_conflict = true;
} }
if ( (! is_age_hash_null4) && if ( (! is_age_hash_null4) &&
(0 != GNUNET_memcmp (h_age_commitment[3], (0 != GNUNET_memcmp (&result[3].h_age_commitment,
&coin[3].h_age_commitment)) ) &coin[3].h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (h_age_commitment[3])); GNUNET_break (GNUNET_is_zero (&result[3].h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; result[3].age_conflict = true;
} }
return qs;
return TALER_EXCHANGEDB_CKS_PRESENT;
} }
enum GNUNET_DB_QueryStatus
enum TALER_EXCHANGEDB_CoinKnownStatus TEH_PG_batch_ensure_coin_known (
TEH_PG_batch_ensure_coin_known (void *cls, void *cls,
const struct const struct TALER_CoinPublicInfo *coin,
TALER_CoinPublicInfo *coin, struct TALER_EXCHANGEDB_CoinInfo *result,
const struct unsigned int coin_length,
TALER_EXCHANGEDB_CoinInfo *result, unsigned int batch_size)
unsigned int coin_length,
unsigned int batch_size)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
enum TALER_EXCHANGEDB_CoinKnownStatus qs1; enum GNUNET_DB_QueryStatus qs = 0;
enum TALER_EXCHANGEDB_CoinKnownStatus qs2;
enum TALER_EXCHANGEDB_CoinKnownStatus qs4;
unsigned int i = 0; unsigned int i = 0;
while (i < coin_length) while ( (qs >= 0) &&
(i < coin_length) )
{ {
unsigned int bs = GNUNET_MIN (batch_size, unsigned int bs = GNUNET_MIN (batch_size,
coin_length - i); coin_length - i);
bs = 1;
if (bs >= 4) if (bs >= 4)
{ {
qs4 = insert4 (pg, qs = insert4 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 4; i += 4;
continue; continue;
} }
@ -461,17 +448,15 @@ TEH_PG_batch_ensure_coin_known (void *cls,
{ {
case 3: case 3:
case 2: case 2:
qs2 = insert2 (pg, qs = insert2 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 2; i += 2;
break; break;
case 1: case 1:
qs1 = insert1 (pg, qs = insert1 (pg,
&coin[i], &coin[i],
&result[i] &result[i]);
);
i += 1; i += 1;
break; break;
case 0: case 0:
@ -479,5 +464,7 @@ TEH_PG_batch_ensure_coin_known (void *cls,
break; break;
} }
} /* end while */ } /* end while */
return TALER_EXCHANGEDB_CKS_PRESENT; if (qs < 0)
return qs;
return i;
} }

View File

@ -24,12 +24,14 @@
#include "taler_util.h" #include "taler_util.h"
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_exchangedb_plugin.h" #include "taler_exchangedb_plugin.h"
enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_batch_ensure_coin_known (void *cls,
const struct enum GNUNET_DB_QueryStatus
TALER_CoinPublicInfo *coin, TEH_PG_batch_ensure_coin_known (
const struct void *cls,
TALER_EXCHANGEDB_CoinInfo *result, const struct TALER_CoinPublicInfo *coin,
unsigned int coin_length, struct TALER_EXCHANGEDB_CoinInfo *result,
unsigned int batch_size); unsigned int coin_length,
unsigned int batch_size);
#endif #endif

View File

@ -30,11 +30,11 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_begin_revolving_shard (void *cls, TEH_PG_begin_revolving_shard (void *cls,
const char *job_name, const char *job_name,
uint32_t shard_size, uint32_t shard_size,
uint32_t shard_limit, uint32_t shard_limit,
uint32_t *start_row, uint32_t *start_row,
uint32_t *end_row) uint32_t *end_row)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -45,7 +45,7 @@ TEH_PG_begin_revolving_shard (void *cls,
{ {
if (GNUNET_OK != if (GNUNET_OK !=
TEH_PG_start (pg, TEH_PG_start (pg,
"begin_revolving_shard")) "begin_revolving_shard"))
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
@ -64,15 +64,15 @@ TEH_PG_begin_revolving_shard (void *cls,
&last_end), &last_end),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_begin_revolving_shard() */ /* Used in #postgres_begin_revolving_shard() */
PREPARE(pg, PREPARE (pg,
"get_last_revolving_shard", "get_last_revolving_shard",
"SELECT" "SELECT"
" end_row" " end_row"
" FROM revolving_work_shards" " FROM revolving_work_shards"
" WHERE job_name=$1" " WHERE job_name=$1"
" ORDER BY end_row DESC" " ORDER BY end_row DESC"
" LIMIT 1;"); " LIMIT 1;");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_last_revolving_shard", "get_last_revolving_shard",
params, params,
@ -116,7 +116,7 @@ TEH_PG_begin_revolving_shard (void *cls,
(unsigned long long) *start_row, (unsigned long long) *start_row,
(unsigned long long) *end_row); (unsigned long long) *end_row);
/* Used in #postgres_claim_revolving_shard() */ /* Used in #postgres_claim_revolving_shard() */
PREPARE (pg, PREPARE (pg,
"create_revolving_shard", "create_revolving_shard",
"INSERT INTO revolving_work_shards" "INSERT INTO revolving_work_shards"
@ -164,7 +164,7 @@ TEH_PG_begin_revolving_shard (void *cls,
end_row), end_row),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_begin_revolving_shard() */ /* Used in #postgres_begin_revolving_shard() */
PREPARE (pg, PREPARE (pg,
"get_open_revolving_shard", "get_open_revolving_shard",
"SELECT" "SELECT"
@ -206,7 +206,7 @@ TEH_PG_begin_revolving_shard (void *cls,
now = GNUNET_TIME_timestamp_get (); now = GNUNET_TIME_timestamp_get ();
/* Used in #postgres_begin_revolving_shard() */ /* Used in #postgres_begin_revolving_shard() */
PREPARE (pg, PREPARE (pg,
"reclaim_revolving_shard", "reclaim_revolving_shard",
"UPDATE revolving_work_shards" "UPDATE revolving_work_shards"

View File

@ -40,9 +40,10 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_begin_revolving_shard (void *cls, TEH_PG_begin_revolving_shard (void *cls,
const char *job_name, const char *job_name,
uint32_t shard_size, uint32_t shard_size,
uint32_t shard_limit, uint32_t shard_limit,
uint32_t *start_row, uint32_t *start_row,
uint32_t *end_row); uint32_t *end_row);
#endif #endif

View File

@ -38,10 +38,10 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_begin_shard (void *cls, TEH_PG_begin_shard (void *cls,
const char *job_name, const char *job_name,
struct GNUNET_TIME_Relative delay, struct GNUNET_TIME_Relative delay,
uint64_t shard_size, uint64_t shard_size,
uint64_t *start_row, uint64_t *start_row,
uint64_t *end_row); uint64_t *end_row);
#endif #endif

View File

@ -45,7 +45,7 @@ TEH_PG_commit (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Committing transaction `%s'\n", "Committing transaction `%s'\n",
pg->transaction_name); pg->transaction_name);
/* used in #postgres_commit */ /* used in #postgres_commit */
PREPARE (pg, PREPARE (pg,
"do_commit", "do_commit",
"COMMIT"); "COMMIT");

View File

@ -36,7 +36,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_complete_shard (void *cls, TEH_PG_complete_shard (void *cls,
const char *job_name, const char *job_name,
uint64_t start_row, uint64_t start_row,
uint64_t end_row); uint64_t end_row);
#endif #endif

View File

@ -27,8 +27,8 @@
long long long long
TEH_PG_count_known_coins (void *cls, TEH_PG_count_known_coins (void *cls,
const struct const struct
TALER_DenominationHashP *denom_pub_hash) TALER_DenominationHashP *denom_pub_hash)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
uint64_t count; uint64_t count;

View File

@ -33,7 +33,7 @@
*/ */
long long long long
TEH_PG_count_known_coins (void *cls, TEH_PG_count_known_coins (void *cls,
const struct const struct
TALER_DenominationHashP *denom_pub_hash); TALER_DenominationHashP *denom_pub_hash);
#endif #endif

View File

@ -46,18 +46,18 @@ TEH_PG_create_aggregation_transient (
GNUNET_PQ_query_param_auto_from_type (wtid), GNUNET_PQ_query_param_auto_from_type (wtid),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
/* Used in #postgres_create_aggregation_transient() */ /* Used in #postgres_create_aggregation_transient() */
PREPARE (pg, PREPARE (pg,
"create_aggregation_transient", "create_aggregation_transient",
"INSERT INTO aggregation_transient" "INSERT INTO aggregation_transient"
" (amount_val" " (amount_val"
" ,amount_frac" " ,amount_frac"
" ,merchant_pub" " ,merchant_pub"
" ,wire_target_h_payto" " ,wire_target_h_payto"
" ,legitimization_requirement_serial_id" " ,legitimization_requirement_serial_id"
" ,exchange_account_section" " ,exchange_account_section"
" ,wtid_raw)" " ,wtid_raw)"
" VALUES ($1, $2, $3, $4, $5, $6, $7);"); " VALUES ($1, $2, $3, $4, $5, $6, $7);");
return GNUNET_PQ_eval_prepared_non_select (pg->conn, return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"create_aggregation_transient", "create_aggregation_transient",
params); params);

View File

@ -48,5 +48,3 @@ TEH_PG_delete_aggregation_transient (
"delete_aggregation_transient", "delete_aggregation_transient",
params); params);
} }

View File

@ -39,4 +39,3 @@ TEH_PG_delete_shard_locks (void *cls)
return GNUNET_PQ_exec_statements (pg->conn, return GNUNET_PQ_exec_statements (pg->conn,
es); es);
} }

View File

@ -60,8 +60,8 @@ TEH_PG_do_batch_withdraw (
pg->legal_reserve_expiration_time)); pg->legal_reserve_expiration_time));
/* Used in #postgres_do_batch_withdraw() to /* Used in #postgres_do_batch_withdraw() to
update the reserve balance and check its status */ update the reserve balance and check its status */
PREPARE (pg, PREPARE (pg,
"call_batch_withdraw", "call_batch_withdraw",
"SELECT " "SELECT "
@ -75,4 +75,3 @@ TEH_PG_do_batch_withdraw (
params, params,
rs); rs);
} }

View File

@ -59,9 +59,9 @@ TEH_PG_do_batch_withdraw_insert (
nonce_reuse), nonce_reuse),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_do_batch_withdraw_insert() to store /* Used in #postgres_do_batch_withdraw_insert() to store
the signature of a blinded coin with the blinded coin's the signature of a blinded coin with the blinded coin's
details. */ details. */
PREPARE (pg, PREPARE (pg,
"call_batch_withdraw_insert", "call_batch_withdraw_insert",
"SELECT " "SELECT "

View File

@ -69,8 +69,8 @@ TEH_PG_do_deposit (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_do_deposit() to execute a deposit, /* Used in #postgres_do_deposit() to execute a deposit,
checking the coin's balance in the process as needed. */ checking the coin's balance in the process as needed. */
PREPARE (pg, PREPARE (pg,
"call_deposit", "call_deposit",
"SELECT " "SELECT "

View File

@ -63,7 +63,7 @@ TEH_PG_do_melt (
}; };
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
/* Used in #postgres_do_melt() to melt a coin. */ /* Used in #postgres_do_melt() to melt a coin. */
PREPARE (pg, PREPARE (pg,
"call_melt", "call_melt",
"SELECT " "SELECT "

View File

@ -75,7 +75,7 @@ TEH_PG_do_purse_merge (
&h_payto); &h_payto);
GNUNET_free (payto_uri); GNUNET_free (payto_uri);
} }
/* Used in #postgres_do_purse_merge() */ /* Used in #postgres_do_purse_merge() */
PREPARE (pg, PREPARE (pg,
"call_purse_merge", "call_purse_merge",
"SELECT" "SELECT"

View File

@ -70,7 +70,6 @@ TEH_PG_do_recoup (
}; };
PREPARE (pg, PREPARE (pg,
"call_recoup", "call_recoup",
"SELECT " "SELECT "

View File

@ -53,4 +53,5 @@ TEH_PG_do_recoup_refresh (
struct GNUNET_TIME_Timestamp *recoup_timestamp, struct GNUNET_TIME_Timestamp *recoup_timestamp,
bool *recoup_ok, bool *recoup_ok,
bool *internal_failure); bool *internal_failure);
#endif #endif

View File

@ -72,7 +72,7 @@ TEH_PG_do_refund (
GNUNET_break (0); GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
/* Used in #postgres_do_refund() to refund a deposit. */ /* Used in #postgres_do_refund() to refund a deposit. */
PREPARE (pg, PREPARE (pg,
"call_refund", "call_refund",
"SELECT " "SELECT "

View File

@ -82,5 +82,3 @@ TEH_PG_do_withdraw (
params, params,
rs); rs);
} }

View File

@ -28,8 +28,8 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_drain_kyc_alert (void *cls, TEH_PG_drain_kyc_alert (void *cls,
uint32_t trigger_type, uint32_t trigger_type,
struct TALER_PaytoHashP *h_payto) struct TALER_PaytoHashP *h_payto)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {

View File

@ -34,7 +34,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_drain_kyc_alert (void *cls, TEH_PG_drain_kyc_alert (void *cls,
uint32_t trigger_type, uint32_t trigger_type,
struct TALER_PaytoHashP *h_payto); struct TALER_PaytoHashP *h_payto);
#endif #endif

View File

@ -28,10 +28,10 @@
enum TALER_EXCHANGEDB_CoinKnownStatus enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_ensure_coin_known (void *cls, TEH_PG_ensure_coin_known (void *cls,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash, struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHash *h_age_commitment) struct TALER_AgeCommitmentHash *h_age_commitment)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;

View File

@ -37,9 +37,9 @@
*/ */
enum TALER_EXCHANGEDB_CoinKnownStatus enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_ensure_coin_known (void *cls, TEH_PG_ensure_coin_known (void *cls,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash, struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHash *h_age_commitment); struct TALER_AgeCommitmentHash *h_age_commitment);
#endif #endif

View File

@ -38,10 +38,10 @@
*/ */
struct GNUNET_DB_EventHandler * struct GNUNET_DB_EventHandler *
TEH_PG_event_listen (void *cls, TEH_PG_event_listen (void *cls,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
const struct GNUNET_DB_EventHeaderP *es, const struct GNUNET_DB_EventHeaderP *es,
GNUNET_DB_EventCallback cb, GNUNET_DB_EventCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;

View File

@ -37,9 +37,9 @@
*/ */
struct GNUNET_DB_EventHandler * struct GNUNET_DB_EventHandler *
TEH_PG_event_listen (void *cls, TEH_PG_event_listen (void *cls,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
const struct GNUNET_DB_EventHeaderP *es, const struct GNUNET_DB_EventHeaderP *es,
GNUNET_DB_EventCallback cb, GNUNET_DB_EventCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -26,10 +26,9 @@
#include "pg_helper.h" #include "pg_helper.h"
void void
TEH_PG_event_listen_cancel (void *cls, TEH_PG_event_listen_cancel (void *cls,
struct GNUNET_DB_EventHandler *eh) struct GNUNET_DB_EventHandler *eh)
{ {
(void) cls; (void) cls;

View File

@ -28,9 +28,9 @@
void void
TEH_PG_event_notify (void *cls, TEH_PG_event_notify (void *cls,
const struct GNUNET_DB_EventHeaderP *es, const struct GNUNET_DB_EventHeaderP *es,
const void *extra, const void *extra,
size_t extra_size) size_t extra_size)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;

View File

@ -35,8 +35,8 @@
*/ */
void void
TEH_PG_event_notify (void *cls, TEH_PG_event_notify (void *cls,
const struct GNUNET_DB_EventHeaderP *es, const struct GNUNET_DB_EventHeaderP *es,
const void *extra, const void *extra,
size_t extra_size); size_t extra_size);
#endif #endif

View File

@ -128,7 +128,7 @@ TEH_PG_find_aggregation_transient (
.pg = pg, .pg = pg,
.status = GNUNET_OK .status = GNUNET_OK
}; };
/* Used in #postgres_find_aggregation_transient() */ /* Used in #postgres_find_aggregation_transient() */
PREPARE (pg, PREPARE (pg,
"find_transient_aggregations", "find_transient_aggregations",
"SELECT" "SELECT"

View File

@ -35,4 +35,5 @@
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TEH_PG_gc (void *cls); TEH_PG_gc (void *cls);
#endif #endif

View File

@ -49,9 +49,9 @@ TEH_PG_get_coin_denomination (
"Getting coin denomination of coin %s\n", "Getting coin denomination of coin %s\n",
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));
/* Used in #postgres_get_coin_denomination() to fetch /* Used in #postgres_get_coin_denomination() to fetch
the denomination public key hash for the denomination public key hash for
a coin known to the exchange. */ a coin known to the exchange. */
PREPARE (pg, PREPARE (pg,
"get_coin_denomination", "get_coin_denomination",
"SELECT" "SELECT"
@ -67,5 +67,3 @@ TEH_PG_get_coin_denomination (
params, params,
rs); rs);
} }

View File

@ -46,15 +46,15 @@ TEH_PG_get_denomination_revocation (
}; };
PREPARE (pg, PREPARE (pg,
"denomination_revocation_get", "denomination_revocation_get",
"SELECT" "SELECT"
" master_sig" " master_sig"
",denom_revocations_serial_id" ",denom_revocations_serial_id"
" FROM denomination_revocations" " FROM denomination_revocations"
" WHERE denominations_serial=" " WHERE denominations_serial="
" (SELECT denominations_serial" " (SELECT denominations_serial"
" FROM denominations" " FROM denominations"
" WHERE denom_pub_hash=$1);"); " WHERE denom_pub_hash=$1);");
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"denomination_revocation_get", "denomination_revocation_get",

View File

@ -41,4 +41,5 @@ TEH_PG_get_denomination_revocation (
const struct TALER_DenominationHashP *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_MasterSignatureP *master_sig, struct TALER_MasterSignatureP *master_sig,
uint64_t *rowid); uint64_t *rowid);
#endif #endif

View File

@ -36,6 +36,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_extension_manifest (void *cls, TEH_PG_get_extension_manifest (void *cls,
const char *extension_name, const char *extension_name,
char **manifest); char **manifest);
#endif #endif

View File

@ -28,14 +28,14 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fee (void *cls, TEH_PG_get_global_fee (void *cls,
struct GNUNET_TIME_Timestamp date, struct GNUNET_TIME_Timestamp date,
struct GNUNET_TIME_Timestamp *start_date, struct GNUNET_TIME_Timestamp *start_date,
struct GNUNET_TIME_Timestamp *end_date, struct GNUNET_TIME_Timestamp *end_date,
struct TALER_GlobalFeeSet *fees, struct TALER_GlobalFeeSet *fees,
struct GNUNET_TIME_Relative *purse_timeout, struct GNUNET_TIME_Relative *purse_timeout,
struct GNUNET_TIME_Relative *history_expiration, struct GNUNET_TIME_Relative *history_expiration,
uint32_t *purse_account_limit, uint32_t *purse_account_limit,
struct TALER_MasterSignatureP *master_sig) struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -65,25 +65,25 @@ TEH_PG_get_global_fee (void *cls,
}; };
/* Used in #postgres_get_global_fee() */ /* Used in #postgres_get_global_fee() */
PREPARE(pg, PREPARE (pg,
"get_global_fee", "get_global_fee",
"SELECT " "SELECT "
" start_date" " start_date"
",end_date" ",end_date"
",history_fee_val" ",history_fee_val"
",history_fee_frac" ",history_fee_frac"
",account_fee_val" ",account_fee_val"
",account_fee_frac" ",account_fee_frac"
",purse_fee_val" ",purse_fee_val"
",purse_fee_frac" ",purse_fee_frac"
",purse_timeout" ",purse_timeout"
",history_expiration" ",history_expiration"
",purse_account_limit" ",purse_account_limit"
",master_sig" ",master_sig"
" FROM global_fee" " FROM global_fee"
" WHERE start_date <= $1" " WHERE start_date <= $1"
" AND end_date > $1;"); " AND end_date > $1;");
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_global_fee", "get_global_fee",
params, params,

View File

@ -40,13 +40,13 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fee (void *cls, TEH_PG_get_global_fee (void *cls,
struct GNUNET_TIME_Timestamp date, struct GNUNET_TIME_Timestamp date,
struct GNUNET_TIME_Timestamp *start_date, struct GNUNET_TIME_Timestamp *start_date,
struct GNUNET_TIME_Timestamp *end_date, struct GNUNET_TIME_Timestamp *end_date,
struct TALER_GlobalFeeSet *fees, struct TALER_GlobalFeeSet *fees,
struct GNUNET_TIME_Relative *purse_timeout, struct GNUNET_TIME_Relative *purse_timeout,
struct GNUNET_TIME_Relative *history_expiration, struct GNUNET_TIME_Relative *history_expiration,
uint32_t *purse_account_limit, uint32_t *purse_account_limit,
struct TALER_MasterSignatureP *master_sig); struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -121,11 +121,10 @@ global_fees_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fees (void *cls, TEH_PG_get_global_fees (void *cls,
TALER_EXCHANGEDB_GlobalFeeCallback cb, TALER_EXCHANGEDB_GlobalFeeCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Timestamp date struct GNUNET_TIME_Timestamp date
@ -144,7 +143,7 @@ TEH_PG_get_global_fees (void *cls,
.status = GNUNET_OK .status = GNUNET_OK
}; };
/* Used in #postgres_get_global_fees() */ /* Used in #postgres_get_global_fees() */
PREPARE (pg, PREPARE (pg,
"get_global_fees", "get_global_fees",
"SELECT " "SELECT "
@ -169,7 +168,3 @@ TEH_PG_get_global_fees (void *cls,
&global_fees_cb, &global_fees_cb,
&gctx); &gctx);
} }

View File

@ -35,6 +35,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_global_fees (void *cls, TEH_PG_get_global_fees (void *cls,
TALER_EXCHANGEDB_GlobalFeeCallback cb, TALER_EXCHANGEDB_GlobalFeeCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -27,8 +27,8 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_known_coin (void *cls, TEH_PG_get_known_coin (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_CoinPublicInfo *coin_info) struct TALER_CoinPublicInfo *coin_info)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -51,9 +51,9 @@ TEH_PG_get_known_coin (void *cls,
"Getting known coin data for coin %s\n", "Getting known coin data for coin %s\n",
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));
coin_info->coin_pub = *coin_pub; coin_info->coin_pub = *coin_pub;
/* Used in #postgres_get_known_coin() to fetch /* Used in #postgres_get_known_coin() to fetch
the denomination public key and signature for the denomination public key and signature for
a coin known to the exchange. */ a coin known to the exchange. */
PREPARE (pg, PREPARE (pg,
"get_known_coin", "get_known_coin",
"SELECT" "SELECT"

View File

@ -34,7 +34,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_known_coin (void *cls, TEH_PG_get_known_coin (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_CoinPublicInfo *coin_info); struct TALER_CoinPublicInfo *coin_info);
#endif #endif

View File

@ -28,9 +28,9 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_melt (void *cls, TEH_PG_get_melt (void *cls,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
struct TALER_EXCHANGEDB_Melt *melt, struct TALER_EXCHANGEDB_Melt *melt,
uint64_t *melt_serial_id) uint64_t *melt_serial_id)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
bool h_age_commitment_is_null; bool h_age_commitment_is_null;
@ -66,8 +66,8 @@ TEH_PG_get_melt (void *cls,
0, 0,
sizeof (melt->session.coin.denom_sig)); sizeof (melt->session.coin.denom_sig));
/* Used in #postgres_get_melt() to fetch /* Used in #postgres_get_melt() to fetch
high-level information about a melt operation */ high-level information about a melt operation */
PREPARE (pg, PREPARE (pg,
"get_melt", "get_melt",
/* "SELECT" /* "SELECT"

View File

@ -37,8 +37,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_melt (void *cls, TEH_PG_get_melt (void *cls,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
struct TALER_EXCHANGEDB_Melt *melt, struct TALER_EXCHANGEDB_Melt *melt,
uint64_t *melt_serial_id); uint64_t *melt_serial_id);
#endif #endif

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_old_coin_by_h_blind ( TEH_PG_get_old_coin_by_h_blind (
void *cls, void *cls,
@ -47,7 +46,7 @@ TEH_PG_get_old_coin_by_h_blind (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_get_old_coin_by_h_blind() */ /* Used in #postgres_get_old_coin_by_h_blind() */
PREPARE (pg, PREPARE (pg,
"old_coin_by_h_blind", "old_coin_by_h_blind",
"SELECT" "SELECT"

View File

@ -41,4 +41,5 @@ TEH_PG_get_old_coin_by_h_blind (
const struct TALER_BlindedCoinHashP *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
struct TALER_CoinSpendPublicKeyP *old_coin_pub, struct TALER_CoinSpendPublicKeyP *old_coin_pub,
uint64_t *rrc_serial); uint64_t *rrc_serial);
#endif #endif

View File

@ -57,7 +57,6 @@ TEH_PG_get_policy_details (
}; };
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_policy_details", "get_policy_details",
params, params,

View File

@ -61,7 +61,7 @@ TEH_PG_get_purse_deposit (
*partner_url = NULL; *partner_url = NULL;
/* Used in #postgres_get_purse_deposit */ /* Used in #postgres_get_purse_deposit */
PREPARE (pg, PREPARE (pg,
"select_purse_deposit_by_coin_pub", "select_purse_deposit_by_coin_pub",
"SELECT " "SELECT "

View File

@ -59,7 +59,7 @@ TEH_PG_get_purse_request (
purse_sig), purse_sig),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
PREPARE (pg, PREPARE (pg,
"get_purse_request", "get_purse_request",
"SELECT " "SELECT "
@ -80,4 +80,3 @@ TEH_PG_get_purse_request (
params, params,
rs); rs);
} }

View File

@ -38,9 +38,9 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_ready_deposit (void *cls, TEH_PG_get_ready_deposit (void *cls,
uint64_t start_shard_row, uint64_t start_shard_row,
uint64_t end_shard_row, uint64_t end_shard_row,
struct TALER_MerchantPublicKeyP *merchant_pub, struct TALER_MerchantPublicKeyP *merchant_pub,
char **payto_uri); char **payto_uri);
#endif #endif

View File

@ -133,14 +133,11 @@ add_revealed_coins (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_refresh_reveal (void *cls, TEH_PG_get_refresh_reveal (void *cls,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
TALER_EXCHANGEDB_RefreshCallback cb, TALER_EXCHANGEDB_RefreshCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GetRevealContext grctx; struct GetRevealContext grctx;
@ -154,8 +151,8 @@ TEH_PG_get_refresh_reveal (void *cls,
0, 0,
sizeof (grctx)); sizeof (grctx));
/* Obtain information about the coins created in a refresh /* Obtain information about the coins created in a refresh
operation, used in #postgres_get_refresh_reveal() */ operation, used in #postgres_get_refresh_reveal() */
PREPARE (pg, PREPARE (pg,
"get_refresh_revealed_coins", "get_refresh_revealed_coins",
"SELECT " "SELECT "

View File

@ -37,8 +37,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_refresh_reveal (void *cls, TEH_PG_get_refresh_reveal (void *cls,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
TALER_EXCHANGEDB_RefreshCallback cb, TALER_EXCHANGEDB_RefreshCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -27,8 +27,8 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_reserve_balance (void *cls, TEH_PG_get_reserve_balance (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
struct TALER_Amount *balance) struct TALER_Amount *balance)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {

View File

@ -34,7 +34,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_reserve_balance (void *cls, TEH_PG_get_reserve_balance (void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
struct TALER_Amount *balance); struct TALER_Amount *balance);
#endif #endif

View File

@ -45,7 +45,7 @@ TEH_PG_get_reserve_by_h_blind (
reserve_out_serial_id), reserve_out_serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_get_reserve_by_h_blind() */ /* Used in #postgres_get_reserve_by_h_blind() */
PREPARE (pg, PREPARE (pg,
"reserve_by_h_blind", "reserve_by_h_blind",
"SELECT" "SELECT"

View File

@ -92,12 +92,10 @@ get_wire_accounts_cb (void *cls,
} }
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_accounts (void *cls, TEH_PG_get_wire_accounts (void *cls,
TALER_EXCHANGEDB_WireAccountCallback cb, TALER_EXCHANGEDB_WireAccountCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GetWireAccountsContext ctx = { struct GetWireAccountsContext ctx = {
@ -111,12 +109,12 @@ TEH_PG_get_wire_accounts (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
PREPARE (pg, PREPARE (pg,
"get_wire_accounts", "get_wire_accounts",
"SELECT" "SELECT"
" payto_uri" " payto_uri"
",master_sig" ",master_sig"
" FROM wire_accounts" " FROM wire_accounts"
" WHERE is_active"); " WHERE is_active");
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
"get_wire_accounts", "get_wire_accounts",
params, params,

View File

@ -36,7 +36,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_accounts (void *cls, TEH_PG_get_wire_accounts (void *cls,
TALER_EXCHANGEDB_WireAccountCallback cb, TALER_EXCHANGEDB_WireAccountCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -27,12 +27,12 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_fee (void *cls, TEH_PG_get_wire_fee (void *cls,
const char *type, const char *type,
struct GNUNET_TIME_Timestamp date, struct GNUNET_TIME_Timestamp date,
struct GNUNET_TIME_Timestamp *start_date, struct GNUNET_TIME_Timestamp *start_date,
struct GNUNET_TIME_Timestamp *end_date, struct GNUNET_TIME_Timestamp *end_date,
struct TALER_WireFeeSet *fees, struct TALER_WireFeeSet *fees,
struct TALER_MasterSignatureP *master_sig) struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -55,22 +55,21 @@ TEH_PG_get_wire_fee (void *cls,
}; };
/* Used in #postgres_get_wire_fee() */
/* Used in #postgres_get_wire_fee() */ PREPARE (pg,
PREPARE(pg, "get_wire_fee",
"get_wire_fee", "SELECT "
"SELECT " " start_date"
" start_date" ",end_date"
",end_date" ",wire_fee_val"
",wire_fee_val" ",wire_fee_frac"
",wire_fee_frac" ",closing_fee_val"
",closing_fee_val" ",closing_fee_frac"
",closing_fee_frac" ",master_sig"
",master_sig" " FROM wire_fee"
" FROM wire_fee" " WHERE wire_method=$1"
" WHERE wire_method=$1" " AND start_date <= $2"
" AND start_date <= $2" " AND end_date > $2;");
" AND end_date > $2;");
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_wire_fee", "get_wire_fee",
params, params,

View File

@ -39,11 +39,11 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_fee (void *cls, TEH_PG_get_wire_fee (void *cls,
const char *type, const char *type,
struct GNUNET_TIME_Timestamp date, struct GNUNET_TIME_Timestamp date,
struct GNUNET_TIME_Timestamp *start_date, struct GNUNET_TIME_Timestamp *start_date,
struct GNUNET_TIME_Timestamp *end_date, struct GNUNET_TIME_Timestamp *end_date,
struct TALER_WireFeeSet *fees, struct TALER_WireFeeSet *fees,
struct TALER_MasterSignatureP *master_sig); struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -109,9 +109,9 @@ get_wire_fees_cb (void *cls,
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_fees (void *cls, TEH_PG_get_wire_fees (void *cls,
const char *wire_method, const char *wire_method,
TALER_EXCHANGEDB_WireFeeCallback cb, TALER_EXCHANGEDB_WireFeeCallback cb,
void *cb_cls) void *cb_cls)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {

View File

@ -37,8 +37,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_get_wire_fees (void *cls, TEH_PG_get_wire_fees (void *cls,
const char *wire_method, const char *wire_method,
TALER_EXCHANGEDB_WireFeeCallback cb, TALER_EXCHANGEDB_WireFeeCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -55,10 +55,10 @@ TEH_PG_get_withdraw_info (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_get_withdraw_info() to /* Used in #postgres_get_withdraw_info() to
locate the response for a /reserve/withdraw request locate the response for a /reserve/withdraw request
using the hash of the blinded message. Used to using the hash of the blinded message. Used to
make sure /reserve/withdraw requests are idempotent. */ make sure /reserve/withdraw requests are idempotent. */
PREPARE (pg, PREPARE (pg,
"get_withdraw_info", "get_withdraw_info",
"SELECT" "SELECT"

View File

@ -71,29 +71,29 @@ TEH_PG_have_deposit2 (
"Getting deposits for coin %s\n", "Getting deposits for coin %s\n",
TALER_B2S (coin_pub)); TALER_B2S (coin_pub));
/* Fetch an existing deposit request, used to ensure idempotency /* Fetch an existing deposit request, used to ensure idempotency
during /deposit processing. Used in #postgres_have_deposit(). */ during /deposit processing. Used in #postgres_have_deposit(). */
PREPARE (pg, PREPARE (pg,
"get_deposit", "get_deposit",
"SELECT" "SELECT"
" dep.amount_with_fee_val" " dep.amount_with_fee_val"
",dep.amount_with_fee_frac" ",dep.amount_with_fee_frac"
",denominations.fee_deposit_val" ",denominations.fee_deposit_val"
",denominations.fee_deposit_frac" ",denominations.fee_deposit_frac"
",dep.wallet_timestamp" ",dep.wallet_timestamp"
",dep.exchange_timestamp" ",dep.exchange_timestamp"
",dep.refund_deadline" ",dep.refund_deadline"
",dep.wire_deadline" ",dep.wire_deadline"
",dep.h_contract_terms" ",dep.h_contract_terms"
",dep.wire_salt" ",dep.wire_salt"
",wt.payto_uri AS receiver_wire_account" ",wt.payto_uri AS receiver_wire_account"
" FROM deposits dep" " FROM deposits dep"
" JOIN known_coins kc ON (kc.coin_pub = dep.coin_pub)" " JOIN known_coins kc ON (kc.coin_pub = dep.coin_pub)"
" JOIN denominations USING (denominations_serial)" " JOIN denominations USING (denominations_serial)"
" JOIN wire_targets wt USING (wire_target_h_payto)" " JOIN wire_targets wt USING (wire_target_h_payto)"
" WHERE dep.coin_pub=$1" " WHERE dep.coin_pub=$1"
" AND dep.merchant_pub=$3" " AND dep.merchant_pub=$3"
" AND dep.h_contract_terms=$2;"); " AND dep.h_contract_terms=$2;");
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"get_deposit", "get_deposit",

View File

@ -51,4 +51,3 @@ TEH_PG_insert_aggregation_tracking (
"insert_aggregation_tracking", "insert_aggregation_tracking",
params); params);
} }

View File

@ -40,4 +40,3 @@ TEH_PG_insert_aggregation_tracking (
unsigned long long deposit_serial_id); unsigned long long deposit_serial_id);
#endif #endif

View File

@ -27,10 +27,10 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_auditor (void *cls, TEH_PG_insert_auditor (void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url, const char *auditor_url,
const char *auditor_name, const char *auditor_name,
struct GNUNET_TIME_Timestamp start_date) struct GNUNET_TIME_Timestamp start_date)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -41,7 +41,7 @@ TEH_PG_insert_auditor (void *cls,
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
/* used in #postgres_insert_auditor() */ /* used in #postgres_insert_auditor() */
PREPARE (pg, PREPARE (pg,
"insert_auditor", "insert_auditor",
"INSERT INTO auditors " "INSERT INTO auditors "

View File

@ -38,8 +38,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_auditor (void *cls, TEH_PG_insert_auditor (void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url, const char *auditor_url,
const char *auditor_name, const char *auditor_name,
struct GNUNET_TIME_Timestamp start_date); struct GNUNET_TIME_Timestamp start_date);
#endif #endif

View File

@ -45,20 +45,20 @@ TEH_PG_insert_contract (
}; };
*in_conflict = false; *in_conflict = false;
/* Used in #postgres_insert_contract() */ /* Used in #postgres_insert_contract() */
PREPARE (pg, PREPARE (pg,
"insert_contract", "insert_contract",
"INSERT INTO contracts" "INSERT INTO contracts"
" (purse_pub" " (purse_pub"
" ,pub_ckey" " ,pub_ckey"
" ,e_contract" " ,e_contract"
" ,contract_sig" " ,contract_sig"
" ,purse_expiration" " ,purse_expiration"
" ) SELECT " " ) SELECT "
" $1, $2, $3, $4, purse_expiration" " $1, $2, $3, $4, purse_expiration"
" FROM purse_requests" " FROM purse_requests"
" WHERE purse_pub=$1" " WHERE purse_pub=$1"
" ON CONFLICT DO NOTHING;"); " ON CONFLICT DO NOTHING;");
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_contract", "insert_contract",
params); params);
@ -68,8 +68,8 @@ TEH_PG_insert_contract (
struct TALER_EncryptedContract econtract2; struct TALER_EncryptedContract econtract2;
qs = TEH_PG_select_contract_by_purse (pg, qs = TEH_PG_select_contract_by_purse (pg,
purse_pub, purse_pub,
&econtract2); &econtract2);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -39,7 +39,7 @@ TEH_PG_insert_denomination_revocation (
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
/* Used in #postgres_insert_denomination_revocation() */ /* Used in #postgres_insert_denomination_revocation() */
PREPARE (pg, PREPARE (pg,
"denomination_revocation_insert", "denomination_revocation_insert",
"INSERT INTO denomination_revocations " "INSERT INTO denomination_revocations "

View File

@ -34,7 +34,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_deposit (void *cls, TEH_PG_insert_deposit (void *cls,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
const struct TALER_EXCHANGEDB_Deposit *deposit); const struct TALER_EXCHANGEDB_Deposit *deposit);
#endif #endif

View File

@ -45,7 +45,7 @@ TEH_PG_insert_drain_profit (
GNUNET_PQ_query_param_auto_from_type (master_sig), GNUNET_PQ_query_param_auto_from_type (master_sig),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
/* Used in #postgres_insert_drain_profit() */ /* Used in #postgres_insert_drain_profit() */
PREPARE (pg, PREPARE (pg,
"drain_profit_insert", "drain_profit_insert",
"INSERT INTO profit_drains " "INSERT INTO profit_drains "

View File

@ -28,13 +28,13 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_global_fee (void *cls, TEH_PG_insert_global_fee (void *cls,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date, struct GNUNET_TIME_Timestamp end_date,
const struct TALER_GlobalFeeSet *fees, const struct TALER_GlobalFeeSet *fees,
struct GNUNET_TIME_Relative purse_timeout, struct GNUNET_TIME_Relative purse_timeout,
struct GNUNET_TIME_Relative history_expiration, struct GNUNET_TIME_Relative history_expiration,
uint32_t purse_account_limit, uint32_t purse_account_limit,
const struct TALER_MasterSignatureP *master_sig) const struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -59,14 +59,14 @@ TEH_PG_insert_global_fee (void *cls,
uint32_t pal; uint32_t pal;
qs = TEH_PG_get_global_fee (pg, qs = TEH_PG_get_global_fee (pg,
start_date, start_date,
&sd, &sd,
&ed, &ed,
&wx, &wx,
&pt, &pt,
&he, &he,
&pal, &pal,
&sig); &sig);
if (qs < 0) if (qs < 0)
return qs; return qs;
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
@ -113,7 +113,7 @@ TEH_PG_insert_global_fee (void *cls,
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
} }
/* Used in #postgres_insert_global_fee */ /* Used in #postgres_insert_global_fee */
PREPARE (pg, PREPARE (pg,
"insert_global_fee", "insert_global_fee",
"INSERT INTO global_fee " "INSERT INTO global_fee "

View File

@ -40,11 +40,11 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_global_fee (void *cls, TEH_PG_insert_global_fee (void *cls,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date, struct GNUNET_TIME_Timestamp end_date,
const struct TALER_GlobalFeeSet *fees, const struct TALER_GlobalFeeSet *fees,
struct GNUNET_TIME_Relative purse_timeout, struct GNUNET_TIME_Relative purse_timeout,
struct GNUNET_TIME_Relative history_expiration, struct GNUNET_TIME_Relative history_expiration,
uint32_t purse_account_limit, uint32_t purse_account_limit,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -51,7 +51,7 @@ TEH_PG_insert_history_request (
idempotent), idempotent),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_insert_history_request() */ /* Used in #postgres_insert_history_request() */
PREPARE (pg, PREPARE (pg,
"call_history_request", "call_history_request",
"SELECT" "SELECT"

View File

@ -43,7 +43,7 @@ TEH_PG_insert_kyc_requirement_for_account (
requirement_row), requirement_row),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_insert_kyc_requirement_for_account() */ /* Used in #postgres_insert_kyc_requirement_for_account() */
PREPARE (pg, PREPARE (pg,
"insert_legitimization_requirement", "insert_legitimization_requirement",
"INSERT INTO legitimization_requirements" "INSERT INTO legitimization_requirements"

View File

@ -41,4 +41,5 @@ TEH_PG_insert_kyc_requirement_for_account (
const char *provider_section, const char *provider_section,
const struct TALER_PaytoHashP *h_payto, const struct TALER_PaytoHashP *h_payto,
uint64_t *requirement_row); uint64_t *requirement_row);
#endif #endif

View File

@ -52,7 +52,7 @@ TEH_PG_insert_kyc_requirement_process (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_insert_kyc_requirement_process() */ /* Used in #postgres_insert_kyc_requirement_process() */
PREPARE (pg, PREPARE (pg,
"insert_legitimization_process", "insert_legitimization_process",
"INSERT INTO legitimization_processes" "INSERT INTO legitimization_processes"

View File

@ -45,4 +45,5 @@ TEH_PG_insert_kyc_requirement_process (
const char *provider_account_id, const char *provider_account_id,
const char *provider_legitimization_id, const char *provider_legitimization_id,
uint64_t *process_row); uint64_t *process_row);
#endif #endif

View File

@ -40,12 +40,12 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_partner (void *cls, TEH_PG_insert_partner (void *cls,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date, struct GNUNET_TIME_Timestamp end_date,
struct GNUNET_TIME_Relative wad_frequency, struct GNUNET_TIME_Relative wad_frequency,
const struct TALER_Amount *wad_fee, const struct TALER_Amount *wad_fee,
const char *partner_base_url, const char *partner_base_url,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -28,7 +28,7 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_refund (void *cls, TEH_PG_insert_refund (void *cls,
const struct TALER_EXCHANGEDB_Refund *refund) const struct TALER_EXCHANGEDB_Refund *refund)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -45,7 +45,7 @@ TEH_PG_insert_refund (void *cls,
TALER_amount_cmp_currency (&refund->details.refund_amount, TALER_amount_cmp_currency (&refund->details.refund_amount,
&refund->details.refund_fee)); &refund->details.refund_fee));
/* Used in #postgres_insert_refund() to store refund information */ /* Used in #postgres_insert_refund() to store refund information */
PREPARE (pg, PREPARE (pg,
"insert_refund", "insert_refund",
"INSERT INTO refunds " "INSERT INTO refunds "

View File

@ -57,20 +57,20 @@ TEH_PG_insert_reserve_closed (
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
/* Used in #postgres_insert_reserve_closed() */ /* Used in #postgres_insert_reserve_closed() */
PREPARE (pg, PREPARE (pg,
"reserves_close_insert", "reserves_close_insert",
"INSERT INTO reserves_close " "INSERT INTO reserves_close "
"(reserve_pub" "(reserve_pub"
",execution_date" ",execution_date"
",wtid" ",wtid"
",wire_target_h_payto" ",wire_target_h_payto"
",amount_val" ",amount_val"
",amount_frac" ",amount_frac"
",closing_fee_val" ",closing_fee_val"
",closing_fee_frac" ",closing_fee_frac"
",close_request_row" ",close_request_row"
") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);"); ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);");
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"reserves_close_insert", "reserves_close_insert",
@ -83,7 +83,7 @@ TEH_PG_insert_reserve_closed (
reserve.pub = *reserve_pub; reserve.pub = *reserve_pub;
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
(qs = TEH_PG_reserves_get (cls, (qs = TEH_PG_reserves_get (cls,
&reserve))) &reserve)))
{ {
/* Existence should have been checked before we got here... */ /* Existence should have been checked before we got here... */
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
@ -110,5 +110,5 @@ TEH_PG_insert_reserve_closed (
GNUNET_break (TALER_AAR_RESULT_ZERO == ret); GNUNET_break (TALER_AAR_RESULT_ZERO == ret);
} }
return TEH_PG_reserves_update (cls, return TEH_PG_reserves_update (cls,
&reserve); &reserve);
} }

View File

@ -37,8 +37,8 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire (void *cls, TEH_PG_insert_wire (void *cls,
const char *payto_uri, const char *payto_uri,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -28,11 +28,11 @@
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire_fee (void *cls, TEH_PG_insert_wire_fee (void *cls,
const char *type, const char *type,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date, struct GNUNET_TIME_Timestamp end_date,
const struct TALER_WireFeeSet *fees, const struct TALER_WireFeeSet *fees,
const struct TALER_MasterSignatureP *master_sig) const struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -51,12 +51,12 @@ TEH_PG_insert_wire_fee (void *cls,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
qs = TEH_PG_get_wire_fee (pg, qs = TEH_PG_get_wire_fee (pg,
type, type,
start_date, start_date,
&sd, &sd,
&ed, &ed,
&wx, &wx,
&sig); &sig);
if (qs < 0) if (qs < 0)
return qs; return qs;
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
@ -88,7 +88,7 @@ TEH_PG_insert_wire_fee (void *cls,
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
} }
/* Used in #postgres_insert_wire_fee */ /* Used in #postgres_insert_wire_fee */
PREPARE (pg, PREPARE (pg,
"insert_wire_fee", "insert_wire_fee",
"INSERT INTO wire_fee " "INSERT INTO wire_fee "

View File

@ -38,9 +38,9 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_insert_wire_fee (void *cls, TEH_PG_insert_wire_fee (void *cls,
const char *type, const char *type,
struct GNUNET_TIME_Timestamp start_date, struct GNUNET_TIME_Timestamp start_date,
struct GNUNET_TIME_Timestamp end_date, struct GNUNET_TIME_Timestamp end_date,
const struct TALER_WireFeeSet *fees, const struct TALER_WireFeeSet *fees,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
#endif #endif

View File

@ -36,6 +36,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_iterate_active_auditors (void *cls, TEH_PG_iterate_active_auditors (void *cls,
TALER_EXCHANGEDB_AuditorsCallback cb, TALER_EXCHANGEDB_AuditorsCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -37,7 +37,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_iterate_active_signkeys (void *cls, TEH_PG_iterate_active_signkeys (void *cls,
TALER_EXCHANGEDB_ActiveSignkeysCallback cb, TALER_EXCHANGEDB_ActiveSignkeysCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -41,4 +41,5 @@ TEH_PG_iterate_auditor_denominations (
void *cls, void *cls,
TALER_EXCHANGEDB_AuditorDenominationsCallback cb, TALER_EXCHANGEDB_AuditorDenominationsCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -35,7 +35,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_iterate_denomination_info (void *cls, TEH_PG_iterate_denomination_info (void *cls,
TALER_EXCHANGEDB_DenominationCallback cb, TALER_EXCHANGEDB_DenominationCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -38,7 +38,7 @@
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_iterate_denominations (void *cls, TEH_PG_iterate_denominations (void *cls,
TALER_EXCHANGEDB_DenominationsCallback cb, TALER_EXCHANGEDB_DenominationsCallback cb,
void *cb_cls); void *cb_cls);
#endif #endif

View File

@ -26,7 +26,6 @@
#include "pg_helper.h" #include "pg_helper.h"
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_PG_kyc_provider_account_lookup ( TEH_PG_kyc_provider_account_lookup (
void *cls, void *cls,
@ -48,7 +47,7 @@ TEH_PG_kyc_provider_account_lookup (
process_row), process_row),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_kyc_provider_account_lookup() */ /* Used in #postgres_kyc_provider_account_lookup() */
PREPARE (pg, PREPARE (pg,
"get_wire_target_by_legitimization_id", "get_wire_target_by_legitimization_id",
"SELECT " "SELECT "

View File

@ -44,4 +44,5 @@ TEH_PG_kyc_provider_account_lookup (
const char *provider_legitimization_id, const char *provider_legitimization_id,
struct TALER_PaytoHashP *h_payto, struct TALER_PaytoHashP *h_payto,
uint64_t *process_row); uint64_t *process_row);
#endif #endif

View File

@ -46,7 +46,7 @@ TEH_PG_lookup_auditor_status (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* Used in #postgres_lookup_auditor_status() */ /* Used in #postgres_lookup_auditor_status() */
PREPARE (pg, PREPARE (pg,
"lookup_auditor_status", "lookup_auditor_status",
"SELECT" "SELECT"

View File

@ -60,7 +60,7 @@ TEH_PG_lookup_denomination_key (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
/* used in #postgres_lookup_denomination_key() */ /* used in #postgres_lookup_denomination_key() */
PREPARE (pg, PREPARE (pg,
"lookup_denomination_key", "lookup_denomination_key",
"SELECT" "SELECT"

View File

@ -48,4 +48,5 @@ TEH_PG_lookup_global_fee_by_time (
struct GNUNET_TIME_Relative *purse_timeout, struct GNUNET_TIME_Relative *purse_timeout,
struct GNUNET_TIME_Relative *history_expiration, struct GNUNET_TIME_Relative *history_expiration,
uint32_t *purse_account_limit); uint32_t *purse_account_limit);
#endif #endif

View File

@ -47,4 +47,5 @@ TEH_PG_lookup_kyc_process_by_account (
struct GNUNET_TIME_Absolute *expiration, struct GNUNET_TIME_Absolute *expiration,
char **provider_account_id, char **provider_account_id,
char **provider_legitimization_id); char **provider_legitimization_id);
#endif #endif

View File

@ -62,4 +62,3 @@ TEH_PG_lookup_signing_key (
params, params,
rs); rs);
} }

Some files were not shown because too many files have changed in this diff Show More