This commit is contained in:
Christian Grothoff 2017-06-15 22:10:12 +02:00
parent eb354680b4
commit 0e6c4ba898
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 27 additions and 39 deletions

View File

@ -1159,16 +1159,13 @@ postgres_gc (void *cls)
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use * @param session connection to use
* @param issue issuing information with value, fees and other info about the denomination * @param issue issuing information with value, fees and other info about the denomination
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return operation status result
*/ */
static int static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_info (void *cls, postgres_insert_denomination_info (void *cls,
struct TALER_AUDITORDB_Session *session, struct TALER_AUDITORDB_Session *session,
const struct TALER_DenominationKeyValidityPS *issue) const struct TALER_DenominationKeyValidityPS *issue)
{ {
PGresult *result;
int ret;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->denom_hash), GNUNET_PQ_query_param_auto_from_type (&issue->denom_hash),
GNUNET_PQ_query_param_auto_from_type (&issue->master), GNUNET_PQ_query_param_auto_from_type (&issue->master),
@ -1198,20 +1195,9 @@ postgres_insert_denomination_info (void *cls,
TALER_amount_cmp_currency_nbo (&issue->value, TALER_amount_cmp_currency_nbo (&issue->value,
&issue->fee_refund)); &issue->fee_refund));
result = GNUNET_PQ_exec_prepared (session->conn, return GNUNET_PQ_eval_prepared_non_select (session->conn,
"auditor_denominations_insert", "auditor_denominations_insert",
params); params);
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
ret = GNUNET_SYSERR;
BREAK_DB_ERR (result);
}
else
{
ret = GNUNET_OK;
}
PQclear (result);
return ret;
} }
@ -1237,6 +1223,7 @@ postgres_select_denomination_info (void *cls,
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
PGresult *result; PGresult *result;
result = GNUNET_PQ_exec_prepared (session->conn, result = GNUNET_PQ_exec_prepared (session->conn,
"auditor_denominations_select", "auditor_denominations_select",
params); params);

View File

@ -19,6 +19,7 @@
* @author Gabor X Toth * @author Gabor X Toth
*/ */
#include "platform.h" #include "platform.h"
#include <gnunet/gnunet_db_lib.h>
#include "taler_auditordb_lib.h" #include "taler_auditordb_lib.h"
#include "taler_auditordb_plugin.h" #include "taler_auditordb_plugin.h"
@ -193,7 +194,7 @@ run (void *cls)
TALER_amount_hton (&issue.fee_refresh, &fee_refresh); TALER_amount_hton (&issue.fee_refresh, &fee_refresh);
TALER_amount_hton (&issue.fee_refund, &fee_refund); TALER_amount_hton (&issue.fee_refund, &fee_refund);
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_denomination_info (plugin->cls, plugin->insert_denomination_info (plugin->cls,
session, session,
&issue)); &issue));

View File

@ -485,11 +485,11 @@ reload_keys_denom_iter (void *cls,
session); session);
break; break;
} }
res = TEH_plugin->insert_denomination_info (TEH_plugin->cls, qs = TEH_plugin->insert_denomination_info (TEH_plugin->cls,
session, session,
&dki->denom_pub, &dki->denom_pub,
&dki->issue); &dki->issue);
if (GNUNET_OK != res) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{ {
/* Insert failed!? Very bad error, log and retry */ /* Insert failed!? Very bad error, log and retry */
GNUNET_break (0); GNUNET_break (0);

View File

@ -1143,7 +1143,7 @@ run (void *cls)
if ( (GNUNET_OK != if ( (GNUNET_OK !=
plugin->start (plugin->cls, plugin->start (plugin->cls,
session)) || session)) ||
(GNUNET_OK != (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_denomination_info (plugin->cls, plugin->insert_denomination_info (plugin->cls,
session, session,
&dpk, &dpk,

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014, 2015 GNUnet e.V. Copyright (C) 2014-2017 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -1446,7 +1446,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION: case PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION:
{ {
unsigned int denom_index; unsigned int denom_index;
int ret; enum GNUNET_DB_QueryStatus ret;
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki ; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki ;
denom_index = state->cmd[state->i].details.insert_denomination.index_denom; denom_index = state->cmd[state->i].details.insert_denomination.index_denom;
@ -1455,7 +1455,7 @@ interpret (struct PERF_TALER_EXCHANGEDB_interpreter_state *state)
state->session, state->session,
&dki->denom_pub, &dki->denom_pub,
&dki->issue); &dki->issue);
GNUNET_assert (GNUNET_SYSERR != ret); GNUNET_assert (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == ret);
} }
break; break;

View File

@ -1775,9 +1775,9 @@ execute_prepared_non_select (struct TALER_EXCHANGEDB_Session *session,
* @param session connection to use * @param session connection to use
* @param denom_pub the public key used for signing coins of this denomination * @param denom_pub the public key used for signing coins of this denomination
* @param issue issuing information with value, fees and other info about the coin * @param issue issuing information with value, fees and other info about the coin
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return status of the query
*/ */
static int static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_info (void *cls, postgres_insert_denomination_info (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
@ -1814,7 +1814,7 @@ postgres_insert_denomination_info (void *cls,
TALER_amount_cmp_currency_nbo (&issue->properties.value, TALER_amount_cmp_currency_nbo (&issue->properties.value,
&issue->properties.fee_refund)); &issue->properties.fee_refund));
return execute_prepared_non_select (session, return GNUNET_PQ_eval_prepared_non_select (session->conn,
"denomination_insert", "denomination_insert",
params); params);
} }

View File

@ -259,7 +259,7 @@ create_denom_key_pair (unsigned int size,
dki.issue.properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS)); dki.issue.properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
dki.issue.properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); dki.issue.properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
if (GNUNET_OK != if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_denomination_info (plugin->cls, plugin->insert_denomination_info (plugin->cls,
session, session,
&dki.denom_pub, &dki.denom_pub,

View File

@ -275,9 +275,9 @@ struct TALER_AUDITORDB_Plugin
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param session connection to use * @param session connection to use
* @param issue issuing information with value, fees and other info about the denomination * @param issue issuing information with value, fees and other info about the denomination
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return status of database operation
*/ */
int enum GNUNET_DB_QueryStatus
(*insert_denomination_info)(void *cls, (*insert_denomination_info)(void *cls,
struct TALER_AUDITORDB_Session *session, struct TALER_AUDITORDB_Session *session,
const struct TALER_DenominationKeyValidityPS *issue); const struct TALER_DenominationKeyValidityPS *issue);

View File

@ -1135,9 +1135,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param session connection to use * @param session connection to use
* @param denom_pub the public key used for signing coins of this denomination * @param denom_pub the public key used for signing coins of this denomination
* @param issue issuing information with value, fees and other info about the denomination * @param issue issuing information with value, fees and other info about the denomination
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure * @return status of the query
*/ */
int enum GNUNET_DB_QueryStatus
(*insert_denomination_info) (void *cls, (*insert_denomination_info) (void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,