even more logging on DB issues
This commit is contained in:
parent
930101256e
commit
a2d89f2803
@ -593,7 +593,7 @@ TEH_DB_execute_refund (struct MHD_Connection *connection,
|
|||||||
return TEH_RESPONSE_reply_internal_db_error (connection,
|
return TEH_RESPONSE_reply_internal_db_error (connection,
|
||||||
TALER_EC_REFUND_STORE_DB_ERROR);
|
TALER_EC_REFUND_STORE_DB_ERROR);
|
||||||
}
|
}
|
||||||
COMMIT_TRANSACTION(session, connection);
|
COMMIT_TRANSACTION (session, connection);
|
||||||
|
|
||||||
return TEH_RESPONSE_reply_refund_success (connection,
|
return TEH_RESPONSE_reply_refund_success (connection,
|
||||||
refund);
|
refund);
|
||||||
@ -622,9 +622,11 @@ TEH_DB_execute_reserve_status (struct MHD_Connection *connection,
|
|||||||
return TEH_RESPONSE_reply_internal_db_error (connection,
|
return TEH_RESPONSE_reply_internal_db_error (connection,
|
||||||
TALER_EC_DB_SETUP_FAILED);
|
TALER_EC_DB_SETUP_FAILED);
|
||||||
}
|
}
|
||||||
|
START_TRANSACTION (session, connection);
|
||||||
rh = TEH_plugin->get_reserve_history (TEH_plugin->cls,
|
rh = TEH_plugin->get_reserve_history (TEH_plugin->cls,
|
||||||
session,
|
session,
|
||||||
reserve_pub);
|
reserve_pub);
|
||||||
|
COMMIT_TRANSACTION (session, connection);
|
||||||
if (NULL == rh)
|
if (NULL == rh)
|
||||||
return TEH_RESPONSE_reply_json_pack (connection,
|
return TEH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
|
@ -34,9 +34,17 @@
|
|||||||
* Log a query error.
|
* Log a query error.
|
||||||
*
|
*
|
||||||
* @param result PQ result object of the query that failed
|
* @param result PQ result object of the query that failed
|
||||||
|
* @param conn SQL connection that was used
|
||||||
*/
|
*/
|
||||||
#define QUERY_ERR(result) \
|
#define QUERY_ERR(result,conn) \
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Query failed at %s:%u: %s (%s)\n", __FILE__, __LINE__, PQresultErrorMessage (result), PQresStatus (PQresultStatus (result)))
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
|
||||||
|
"Query failed at %s:%u: %s/%s/%s/%s/%s\n", \
|
||||||
|
__FILE__, __LINE__, \
|
||||||
|
PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
|
||||||
|
PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
|
||||||
|
PQresultErrorMessage (result), \
|
||||||
|
PQresStatus (PQresultStatus (result)), \
|
||||||
|
PQerrorMessage(conn));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1755,7 +1763,7 @@ postgres_get_denomination_info (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -1846,7 +1854,7 @@ postgres_reserve_get (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -1906,7 +1914,7 @@ reserves_update (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus(result))
|
if (PGRES_COMMAND_OK != PQresultStatus(result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
ret = GNUNET_SYSERR;
|
ret = GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1987,7 +1995,7 @@ postgres_reserves_in_insert (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus(result))
|
if (PGRES_COMMAND_OK != PQresultStatus(result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
@ -2031,7 +2039,7 @@ postgres_reserves_in_insert (void *cls,
|
|||||||
session);
|
session);
|
||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
@ -2116,7 +2124,7 @@ postgres_get_withdraw_info (void *cls,
|
|||||||
|
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (0 == PQntuples (result))
|
if (0 == PQntuples (result))
|
||||||
@ -2197,7 +2205,7 @@ postgres_insert_withdraw_info (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -2277,7 +2285,7 @@ postgres_get_reserve_history (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (0 == (rows = PQntuples (result)))
|
if (0 == (rows = PQntuples (result)))
|
||||||
@ -2343,7 +2351,7 @@ postgres_get_reserve_history (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2402,7 +2410,7 @@ postgres_get_reserve_history (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
rows = PQntuples (result);
|
rows = PQntuples (result);
|
||||||
@ -3979,7 +3987,7 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -4836,7 +4844,7 @@ postgres_wire_prepare_data_get (void *cls,
|
|||||||
params);
|
params);
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result);
|
QUERY_ERR (result, session->conn);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user