aboutsummaryrefslogtreecommitdiff
path: root/src/mint/mint_db.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/mint_db.c')
-rw-r--r--src/mint/mint_db.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c
index 91d6705c3..354bb7008 100644
--- a/src/mint/mint_db.c
+++ b/src/mint/mint_db.c
@@ -747,18 +747,18 @@ TALER_MINT_DB_init (const char *connection_cfg)
747 * Get the thread-local database-handle. 747 * Get the thread-local database-handle.
748 * Connect to the db if the connection does not exist yet. 748 * Connect to the db if the connection does not exist yet.
749 * 749 *
750 * @param temporary #GNUNET_YES to use a temporary schema; #GNUNET_NO to use the
751 * database default one
750 * @return the database connection, or NULL on error 752 * @return the database connection, or NULL on error
751 */ 753 */
752PGconn * 754PGconn *
753TALER_MINT_DB_get_connection (void) 755TALER_MINT_DB_get_connection (int temporary)
754{ 756{
755 PGconn *db_conn; 757 PGconn *db_conn;
756 758
757 if (NULL != (db_conn = pthread_getspecific (db_conn_threadlocal))) 759 if (NULL != (db_conn = pthread_getspecific (db_conn_threadlocal)))
758 return db_conn; 760 return db_conn;
759
760 db_conn = PQconnectdb (TALER_MINT_db_connection_cfg_str); 761 db_conn = PQconnectdb (TALER_MINT_db_connection_cfg_str);
761
762 if (CONNECTION_OK != 762 if (CONNECTION_OK !=
763 PQstatus (db_conn)) 763 PQstatus (db_conn))
764 { 764 {
@@ -767,7 +767,12 @@ TALER_MINT_DB_get_connection (void)
767 GNUNET_break (0); 767 GNUNET_break (0);
768 return NULL; 768 return NULL;
769 } 769 }
770 770 if ((GNUNET_YES == temporary)
771 && (GNUNET_SYSERR == set_temporary_schema(db_conn)))
772 {
773 GNUNET_break (0);
774 return NULL;
775 }
771 if (GNUNET_OK != 776 if (GNUNET_OK !=
772 TALER_MINT_DB_prepare (db_conn)) 777 TALER_MINT_DB_prepare (db_conn))
773 { 778 {