Fix broken compilation: add temporary flag to DB_get_connection()

This commit is contained in:
Sree Harsha Totakura 2015-03-05 16:10:42 +01:00
parent f7b5cf02ae
commit 7a37751446

View File

@ -747,18 +747,18 @@ TALER_MINT_DB_init (const char *connection_cfg)
* Get the thread-local database-handle. * Get the thread-local database-handle.
* Connect to the db if the connection does not exist yet. * Connect to the db if the connection does not exist yet.
* *
* @param temporary #GNUNET_YES to use a temporary schema; #GNUNET_NO to use the
* database default one
* @return the database connection, or NULL on error * @return the database connection, or NULL on error
*/ */
PGconn * PGconn *
TALER_MINT_DB_get_connection (void) TALER_MINT_DB_get_connection (int temporary)
{ {
PGconn *db_conn; PGconn *db_conn;
if (NULL != (db_conn = pthread_getspecific (db_conn_threadlocal))) if (NULL != (db_conn = pthread_getspecific (db_conn_threadlocal)))
return db_conn; return db_conn;
db_conn = PQconnectdb (TALER_MINT_db_connection_cfg_str); db_conn = PQconnectdb (TALER_MINT_db_connection_cfg_str);
if (CONNECTION_OK != if (CONNECTION_OK !=
PQstatus (db_conn)) PQstatus (db_conn))
{ {
@ -767,7 +767,12 @@ TALER_MINT_DB_get_connection (void)
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
} }
if ((GNUNET_YES == temporary)
&& (GNUNET_SYSERR == set_temporary_schema(db_conn)))
{
GNUNET_break (0);
return NULL;
}
if (GNUNET_OK != if (GNUNET_OK !=
TALER_MINT_DB_prepare (db_conn)) TALER_MINT_DB_prepare (db_conn))
{ {