Commit 88f9340d authored by Michael Ott's avatar Michael Ott
Browse files

Add db init command to dcdbconfig for triggering an initSchema() call

parent f7820358
......@@ -42,6 +42,7 @@ void DBAction::printHelp(int argc, char* argv[])
std::cout << "The DB command has the following options:" << std::endl;
std::cout << " INSERT <sid> <time> <value> - Insert test data into the data store" << std::endl;
std::cout << " FUZZYTRUNC <time> - Truncate data that is older than <time>" << std::endl;
std::cout << " INIT - Initialize" << std::endl;
}
/*
......@@ -72,16 +73,16 @@ int DBAction::executeCommand(int argc, char* argv[], int argvidx, const char* ho
goto executeCommandError;
}
doInsert(argv[argvidx+1], argv[argvidx+2], argv[argvidx+3]);
}
else if (strcasecmp(argv[argvidx], "FUZZYTRUNC") == 0) {
} else if (strcasecmp(argv[argvidx], "FUZZYTRUNC") == 0) {
/* FUZZYTRUNC needs one more parameter */
if (argvidx+1 >= argc) {
std::cout << "FUZZYTRUNC needs one more parameter!" << std::endl;
goto executeCommandError;
}
doFuzzyTrunc(argv[argvidx+1]);
}
else {
} else if (strcasecmp(argv[argvidx], "INIT") == 0) {
doInitSchema();
} else {
std::cout << "Invalid DB command: " << argv[argvidx] << std::endl;
goto executeCommandError;
}
......@@ -151,3 +152,8 @@ void DBAction::doFuzzyTrunc(std::string timestr)
ds.truncBeforeWeek(ts.getWeekstamp());
}
void DBAction::doInitSchema()
{
connection->initSchema();
}
......@@ -51,6 +51,7 @@ protected:
void doInsert(std::string sidstr, std::string timestr, std::string valuestr);
void doFuzzyTrunc(std::string timestr);
void doInitSchema();
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment