diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-21 14:04:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-21 14:04:13 +0100 |
commit | 067d4891411f7add6256352e661aab9fb0b58266 (patch) | |
tree | 5296c1c4d0d3b998fa7a33c8005b94d0c5c866c5 /src/mint/taler-mint-dbinit.c | |
parent | 7d9a40327587ed99fb20f4c4a5669069c7a51e48 (diff) |
-fix FTBFS
Diffstat (limited to 'src/mint/taler-mint-dbinit.c')
-rw-r--r-- | src/mint/taler-mint-dbinit.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/src/mint/taler-mint-dbinit.c b/src/mint/taler-mint-dbinit.c index 060eabc7b..8056b7df0 100644 --- a/src/mint/taler-mint-dbinit.c +++ b/src/mint/taler-mint-dbinit.c @@ -23,7 +23,7 @@ #include <libpq-fe.h> #include "taler_util.h" #include "taler_mintdb_plugin.h" - +#include "plugin.h" /** * Mint directory with the keys. @@ -35,12 +35,6 @@ static char *mint_base_dir; */ static struct GNUNET_CONFIGURATION_Handle *cfg; -/** - * Database connection handle. - */ -static PGconn *db_conn; - - /** * The main function of the database initialization tool. @@ -61,7 +55,6 @@ main (int argc, &GNUNET_GETOPT_set_filename, &mint_base_dir}, GNUNET_GETOPT_OPTION_END }; - char *db_connection_cfg_str; if (GNUNET_GETOPT_run ("taler-mint-dbinit", options, @@ -78,7 +71,6 @@ main (int argc, "Mint base directory not given.\n"); return 1; } - cfg = TALER_config_load (mint_base_dir); if (NULL == cfg) { @@ -87,32 +79,22 @@ main (int argc, return 1; } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - "mint", - "db", - &db_connection_cfg_str)) + TALER_MINT_plugin_load (cfg)) { fprintf (stderr, - "Configuration 'mint.db' not found.\n"); + "Failed to initialize database plugin.\n"); return 1; } - db_conn = PQconnectdb (db_connection_cfg_str); - if (CONNECTION_OK != PQstatus (db_conn)) - { - fprintf (stderr, - "Database connection failed: %s\n", - PQerrorMessage (db_conn)); - free (db_connection_cfg_str); - return 1; - } - free (db_connection_cfg_str); - - if (GNUNET_OK != TALER_MINT_DB_create_tables (GNUNET_NO)) + if (GNUNET_OK != + plugin->create_tables (plugin->cls, + GNUNET_NO)) { fprintf (stderr, "Failed to initialize database.\n"); + TALER_MINT_plugin_unload (); return 1; } + TALER_MINT_plugin_unload (); return 0; } |