summaryrefslogtreecommitdiff
path: root/ndb/tools
diff options
context:
space:
mode:
authorunknown <jonas@perch.ndb.mysql.com>2005-09-30 12:19:15 +0200
committerunknown <jonas@perch.ndb.mysql.com>2005-09-30 12:19:15 +0200
commitdbc721452094d903f6209e1751a1e29569a06f7e (patch)
treeff6fd9ba1fac6a6d89b264520606a8df1aea4161 /ndb/tools
parent3827a110334a31796b46866ffb8ea469907165de (diff)
downloadmariadb-git-dbc721452094d903f6209e1751a1e29569a06f7e.tar.gz
ndb
Add support/test for using my.cnf [cluster_config] mysql-test/r/ndb_config.result: Add support for ndb_config to read my.cnf mysql-test/t/ndb_config.test: Add support for ndb_config to read my.cnf ndb/src/mgmsrv/InitConfigFileParser.cpp: merge ndb/tools/ndb_config.cpp: Add support for ndb_config to read my.cnf mysql-test/std_data/ndb_config_mycnf1.cnf: New BitKeeper file ``mysql-test/std_data/ndb_config_mycnf1.cnf''
Diffstat (limited to 'ndb/tools')
-rw-r--r--ndb/tools/ndb_config.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/ndb/tools/ndb_config.cpp b/ndb/tools/ndb_config.cpp
index 457021a4ec4..c7c87f8cc37 100644
--- a/ndb/tools/ndb_config.cpp
+++ b/ndb/tools/ndb_config.cpp
@@ -41,6 +41,7 @@ static const char * g_host = 0;
static const char * g_field_delimiter=",";
static const char * g_row_delimiter=" ";
static const char * g_config_file = 0;
+static int g_mycnf = 0;
int g_print_full_config, opt_ndb_shm;
my_bool opt_core;
@@ -94,6 +95,9 @@ static struct my_option my_long_options[] =
{ "config-file", 256, "Path to config.ini",
(gptr*) &g_config_file, (gptr*) &g_config_file,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "mycnf", 256, "Read config from my.cnf",
+ (gptr*) &g_mycnf, (gptr*) &g_mycnf,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -163,11 +167,16 @@ main(int argc, char** argv){
ndb_mgm_configuration * conf = 0;
- if (g_config_file)
+ if (g_config_file || g_mycnf)
conf = load_configuration();
else
conf = fetch_configuration();
+ if (conf == 0)
+ {
+ return -1;
+ }
+
Vector<Apply*> select_list;
Vector<Match*> where_clause;
@@ -437,10 +446,20 @@ ndb_mgm_configuration*
load_configuration()
{
InitConfigFileParser parser(stderr);
+ if (g_config_file)
+ {
+ if (g_verbose)
+ fprintf(stderr, "Using config.ini : %s", g_config_file);
+
+ Config* conf = parser.parseConfig(g_config_file);
+ if (conf)
+ return conf->m_configValues;
+ }
+
if (g_verbose)
- fprintf(stderr, "Using config.ini : %s", g_config_file);
+ fprintf(stderr, "Using my.cnf");
- Config* conf = parser.parseConfig(g_config_file);
+ Config* conf = parser.parse_mycnf();
if (conf)
return conf->m_configValues;