db: Add QUERY_ERR macro to log failed queries

This commit is contained in:
Sree Harsha Totakura 2015-03-05 17:55:19 +01:00
parent 376183ac6a
commit c62dc613ce

View File

@ -42,6 +42,9 @@
static pthread_key_t db_conn_threadlocal; static pthread_key_t db_conn_threadlocal;
#define QUERY_ERR(result) \
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s: query failed: %s\n", __FUNCTION__, PQresultErrorMessage (result))
/** /**
* Database connection string, as read from * Database connection string, as read from
* the configuration. * the configuration.
@ -699,9 +702,7 @@ TALER_MINT_DB_reserve_get (PGconn *db,
params); params);
if (PGRES_TUPLES_OK != PQresultStatus (result)) if (PGRES_TUPLES_OK != PQresultStatus (result))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, QUERY_ERR (result);
"Query failed: %s\n",
PQresultErrorMessage (result));
PQclear (result); PQclear (result);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }