Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
88f9340d
Commit
88f9340d
authored
Dec 21, 2020
by
Michael Ott
Browse files
Add db init command to dcdbconfig for triggering an initSchema() call
parent
f7820358
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/dcdbconfig/dbaction.cpp
View file @
88f9340d
...
...
@@ -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
();
}
tools/dcdbconfig/dbaction.h
View file @
88f9340d
...
...
@@ -51,6 +51,7 @@ protected:
void
doInsert
(
std
::
string
sidstr
,
std
::
string
timestr
,
std
::
string
valuestr
);
void
doFuzzyTrunc
(
std
::
string
timestr
);
void
doInitSchema
();
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment