aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 47ac8e7bf..e144342f4 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -115,6 +115,11 @@ struct PostgresClosure
char *connection_cfg_str;
/**
+ * Directory with SQL statements to run to create tables.
+ */
+ char *sql_dir;
+
+ /**
* After how long should idle reserves be closed?
*/
struct GNUNET_TIME_Relative idle_reserve_expiration_time;
@@ -503,8 +508,8 @@ postgres_create_tables (void *cls)
struct GNUNET_PQ_Context *conn;
conn = GNUNET_PQ_connect (pc->connection_cfg_str,
+ pc->sql_dir,
NULL,
- es,
NULL);
if (NULL == conn)
return GNUNET_SYSERR;
@@ -7489,11 +7494,23 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
const char *ec;
pg = GNUNET_new (struct PostgresClosure);
-
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "exchangedb-postgres",
+ "SQL_DIR",
+ &pg->sql_dir))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchangedb-postgres",
+ "CONFIG");
+ GNUNET_free (pg);
+ return NULL;
+ }
if (0 != pthread_key_create (&pg->db_conn_threadlocal,
&db_conn_destroy))
{
TALER_LOG_ERROR ("Cannnot create pthread key.\n");
+ GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
return NULL;
}
@@ -7513,6 +7530,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchangedb-postgres",
"CONFIG");
+ GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
return NULL;
}
@@ -7533,6 +7551,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchangedb",
"LEGAL/IDLE_RESERVE_EXPIRATION_TIME");
+ GNUNET_free (pg->connection_cfg_str);
+ GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
return NULL;
}
@@ -7545,6 +7565,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"taler",
"CURRENCY");
+ GNUNET_free (pg->connection_cfg_str);
+ GNUNET_free (pg->sql_dir);
GNUNET_free (pg);
return NULL;
}
@@ -7656,6 +7678,7 @@ libtaler_plugin_exchangedb_postgres_done (void *cls)
struct PostgresClosure *pg = plugin->cls;
GNUNET_free (pg->connection_cfg_str);
+ GNUNET_free (pg->sql_dir);
GNUNET_free (pg->currency);
GNUNET_free (pg);
GNUNET_free (plugin);