diff options
author | Gabor X Toth <*@tg-x.net> | 2016-09-22 16:55:06 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2016-09-22 16:55:06 +0000 |
commit | 72ac76db16854deabaa9cd925a50e3fc345d9eb7 (patch) | |
tree | 498d583986c19ae1544ff93a3db57664b5b67ea9 /src/psycstore | |
parent | 74dfd2ebe24c3e5bd4b5413c535cb0d5d337f1ab (diff) | |
download | gnunet-72ac76db16854deabaa9cd925a50e3fc345d9eb7.tar.gz gnunet-72ac76db16854deabaa9cd925a50e3fc345d9eb7.zip |
psycstore-mysql: remove filename config option
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/plugin_psycstore_mysql.c | 35 | ||||
-rw-r--r-- | src/psycstore/psycstore.conf.in | 7 | ||||
-rw-r--r-- | src/psycstore/test_plugin_psycstore_mysql.conf | 7 |
3 files changed, 14 insertions, 35 deletions
diff --git a/src/psycstore/plugin_psycstore_mysql.c b/src/psycstore/plugin_psycstore_mysql.c index 2896f4968..42c12119e 100644 --- a/src/psycstore/plugin_psycstore_mysql.c +++ b/src/psycstore/plugin_psycstore_mysql.c | |||
@@ -81,13 +81,8 @@ struct Plugin | |||
81 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 81 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Database filename. | 84 | * MySQL context. |
85 | */ | 85 | */ |
86 | char *fn; | ||
87 | |||
88 | /** | ||
89 | *Handle to talk to Mysql | ||
90 | */ | ||
91 | struct GNUNET_MYSQL_Context *mc; | 86 | struct GNUNET_MYSQL_Context *mc; |
92 | 87 | ||
93 | /** | 88 | /** |
@@ -278,31 +273,8 @@ mysql_prepare (struct GNUNET_MYSQL_Context *mc, | |||
278 | static int | 273 | static int |
279 | database_setup (struct Plugin *plugin) | 274 | database_setup (struct Plugin *plugin) |
280 | { | 275 | { |
281 | char *filename; | ||
282 | |||
283 | if (GNUNET_OK != | ||
284 | GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "psycstore-mysql", | ||
285 | "FILENAME", &filename)) | ||
286 | { | ||
287 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | ||
288 | "psycstore-mysql", "FILENAME"); | ||
289 | return GNUNET_SYSERR; | ||
290 | } | ||
291 | |||
292 | if (GNUNET_OK != GNUNET_DISK_file_test (filename)) | ||
293 | { | ||
294 | if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (filename)) | ||
295 | { | ||
296 | GNUNET_break (0); | ||
297 | GNUNET_free (filename); | ||
298 | return GNUNET_SYSERR; | ||
299 | } | ||
300 | } | ||
301 | /* filename should be UTF-8-encoded. If it isn't, it's a bug */ | ||
302 | plugin->fn = filename; | ||
303 | |||
304 | /* Open database and precompile statements */ | 276 | /* Open database and precompile statements */ |
305 | plugin->mc = GNUNET_MYSQL_context_create(plugin->cfg, "psycstore-mysql"); | 277 | plugin->mc = GNUNET_MYSQL_context_create (plugin->cfg, "psycstore-mysql"); |
306 | 278 | ||
307 | if (NULL == plugin->mc) | 279 | if (NULL == plugin->mc) |
308 | { | 280 | { |
@@ -601,9 +573,6 @@ static void | |||
601 | database_shutdown (struct Plugin *plugin) | 573 | database_shutdown (struct Plugin *plugin) |
602 | { | 574 | { |
603 | GNUNET_MYSQL_context_destroy (plugin->mc); | 575 | GNUNET_MYSQL_context_destroy (plugin->mc); |
604 | |||
605 | GNUNET_free_non_null (plugin->fn); | ||
606 | |||
607 | } | 576 | } |
608 | 577 | ||
609 | 578 | ||
diff --git a/src/psycstore/psycstore.conf.in b/src/psycstore/psycstore.conf.in index 2828201bd..236471e36 100644 --- a/src/psycstore/psycstore.conf.in +++ b/src/psycstore/psycstore.conf.in | |||
@@ -17,4 +17,9 @@ DATABASE = sqlite | |||
17 | FILENAME = $GNUNET_DATA_HOME/psycstore/sqlite.db | 17 | FILENAME = $GNUNET_DATA_HOME/psycstore/sqlite.db |
18 | 18 | ||
19 | [psycstore-mysql] | 19 | [psycstore-mysql] |
20 | FILENAME = $GNUNET_DATA_HOME/psycstore/mysql.sql | 20 | DATABASE = gnunet |
21 | CONFIG = ~/.my.cnf | ||
22 | # USER = gnunet | ||
23 | # PASSWORD = | ||
24 | # HOST = localhost | ||
25 | # PORT = 3306 | ||
diff --git a/src/psycstore/test_plugin_psycstore_mysql.conf b/src/psycstore/test_plugin_psycstore_mysql.conf index ea0e406d4..e15b3fd63 100644 --- a/src/psycstore/test_plugin_psycstore_mysql.conf +++ b/src/psycstore/test_plugin_psycstore_mysql.conf | |||
@@ -1,2 +1,7 @@ | |||
1 | [psycstore-mysql] | 1 | [psycstore-mysql] |
2 | FILENAME = /tmp/gnunet-test-plugin-psycstore-mysql/mysql.sql | 2 | DATABASE = test |
3 | # CONFIG = ~/.my.cnf | ||
4 | # USER = gnunet | ||
5 | # PASSWORD = | ||
6 | # HOST = localhost | ||
7 | # PORT = 3306 | ||