diff options
author | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-03-05 16:05:06 +0100 |
---|---|---|
committer | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-03-06 10:31:22 +0100 |
commit | 0acd5714e0ea48888e60d4caeeb37188a94e52b1 (patch) | |
tree | 9172d23b53b01ec71b1158ff79c0631d766c15b9 /src/mint/mint_db.h | |
parent | b82a593dbbf5cf4332bd473e17421d230dbeeff8 (diff) | |
download | exchange-0acd5714e0ea48888e60d4caeeb37188a94e52b1.tar.xz |
Move table creation logic to DB layer. Also support temporary schema creation for the sake of testing
Diffstat (limited to 'src/mint/mint_db.h')
-rw-r--r-- | src/mint/mint_db.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mint/mint_db.h b/src/mint/mint_db.h index a32cbd773..b36823803 100644 --- a/src/mint/mint_db.h +++ b/src/mint/mint_db.h @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_util.h" +#define TALER_TEMP_SCHEMA_NAME "taler_temporary" /** * Initialize database subsystem. @@ -42,13 +43,33 @@ TALER_MINT_DB_init (const char *connection_cfg); * Get the thread-local database-handle. * 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 * @param the database connection, or NULL on error */ PGconn * -TALER_MINT_DB_get_connection (void); +TALER_MINT_DB_get_connection (int temporary); /** + * Drop the temporary taler schema. This is only useful for testcases + * + * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure + */ +int +TALER_MINT_DB_drop_temporary (PGconn *db); + + +/** + * Create the necessary tables if they are not present + * + * @param temporary should we use a temporary schema + * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure + */ +int +TALER_MINT_DB_create_tables (int temporary); + +/** * Setup prepared statements. FIXME: should this be part of the API, * or just internal to "TALER_MINT_DB_get_connection()"? * |