fix logging of BEGIN error

This commit is contained in:
Christian Grothoff 2017-03-14 15:36:19 +01:00
parent 4b952b3037
commit 6d798cecba
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1426,14 +1426,16 @@ postgres_start (void *cls,
struct TALER_EXCHANGEDB_Session *session) struct TALER_EXCHANGEDB_Session *session)
{ {
PGresult *result; PGresult *result;
ExecStatusType ex;
result = PQexec (session->conn, result = PQexec (session->conn,
"START TRANSACTION ISOLATION LEVEL SERIALIZABLE"); "START TRANSACTION ISOLATION LEVEL SERIALIZABLE");
if (PGRES_COMMAND_OK != if (PGRES_COMMAND_OK !=
PQresultStatus (result)) (ex = PQresultStatus (result)))
{ {
TALER_LOG_ERROR ("Failed to start transaction: %s\n", TALER_LOG_ERROR ("Failed to start transaction (%s): %s\n",
PQresultErrorMessage (result)); PQresStatus (ex),
PQerrorMessage (session->conn));
GNUNET_break (0); GNUNET_break (0);
PQclear (result); PQclear (result);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -1918,7 +1920,11 @@ postgres_reserves_in_insert (void *cls,
} }
if (GNUNET_OK != postgres_commit (cls, if (GNUNET_OK != postgres_commit (cls,
session)) session))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to commit transaction adding amount to reserve\n");
return GNUNET_SYSERR; return GNUNET_SYSERR;
}
return GNUNET_OK; return GNUNET_OK;
rollback: rollback:
@ -2173,7 +2179,7 @@ postgres_get_reserve_history (void *cls,
} }
rh_tail->type = TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE; rh_tail->type = TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE;
rh_tail->details.bank = bt; rh_tail->details.bank = bt;
} } /* end of 'while (0 < rows)' */
PQclear (result); PQclear (result);
} }
{ {
@ -2232,7 +2238,7 @@ postgres_get_reserve_history (void *cls,
rh_tail = rh_tail->next; rh_tail = rh_tail->next;
rh_tail->type = TALER_EXCHANGEDB_RO_WITHDRAW_COIN; rh_tail->type = TALER_EXCHANGEDB_RO_WITHDRAW_COIN;
rh_tail->details.withdraw = cbc; rh_tail->details.withdraw = cbc;
} } /* end of 'while (0 < rows)' */
ret = GNUNET_OK; ret = GNUNET_OK;
PQclear (result); PQclear (result);
} }