Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
dcdb
dcdb
Commits
7118a5c5
Commit
7118a5c5
authored
Dec 17, 2020
by
Michael Ott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Perform fuzzy query if no start and end timestamp are given
parent
f3c8edba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
tools/dcdbquery/dcdbquery.cpp
tools/dcdbquery/dcdbquery.cpp
+22
-20
No files found.
tools/dcdbquery/dcdbquery.cpp
View file @
7118a5c5
...
...
@@ -45,7 +45,7 @@ void usage(void)
if
(
isatty
(
fileno
(
stdin
)))
{
/* 0---------1---------2---------3---------4---------5---------6---------7--------- */
std
::
cout
<<
"Usage:"
<<
std
::
endl
;
std
::
cout
<<
" dcdbquery [-h <host>] [-r] [-l] <Sensor 1> [<Sensor 2> ...] <Start> <End>"
<<
std
::
endl
;
std
::
cout
<<
" dcdbquery [-h <host>] [-r] [-l] <Sensor 1> [<Sensor 2> ...]
[
<Start> <End>
]
"
<<
std
::
endl
;
std
::
cout
<<
" dcdbquery [-h <host>] [-r] [-l] -j <jobId> <Sensor 1> [<Sensor 2> ...]"
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Parameters:"
<<
std
::
endl
;
...
...
@@ -103,7 +103,7 @@ int main(int argc, char * const argv[])
}
/* Check command line arguments */
if
(
argcReal
<=
3
)
{
if
(
argcReal
<=
1
)
{
usage
();
}
...
...
@@ -142,25 +142,27 @@ int main(int argc, char * const argv[])
/* Try to create TimeStamp objects from the arguments */
DCDB
::
TimeStamp
start
,
end
;
if
(
jobId
.
size
()
==
0
)
{
try
{
bool
local
=
myQuery
->
getLocalTimeEnabled
();
start
=
DCDB
::
TimeStamp
(
argvReal
[
argcReal
-
2
],
local
);
if
(
std
::
string
(
argvReal
[
argcReal
-
2
])
!=
std
::
string
(
argvReal
[
argcReal
-
1
]))
{
end
=
DCDB
::
TimeStamp
(
argvReal
[
argcReal
-
1
],
local
);
}
else
{
end
=
start
;
}
}
catch
(
std
::
exception
&
e
)
{
std
::
cout
<<
"Wrong time format."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
if
(
argcReal
>
2
)
{
try
{
bool
local
=
myQuery
->
getLocalTimeEnabled
();
start
=
DCDB
::
TimeStamp
(
argvReal
[
argcReal
-
2
],
local
);
if
(
std
::
string
(
argvReal
[
argcReal
-
2
])
!=
std
::
string
(
argvReal
[
argcReal
-
1
]))
{
end
=
DCDB
::
TimeStamp
(
argvReal
[
argcReal
-
1
],
local
);
}
else
{
end
=
start
;
}
argcReal
-=
2
;
}
catch
(
std
::
exception
&
e
)
{
/* The last two parameters could not be parsed as timestamps, let's assume they are sensors and do a fuzzy querry */
start
=
end
=
DCDB
::
TimeStamp
();
}
/* Ensure start < end */
if
(
start
>
end
)
{
std
::
cout
<<
"Start time must be earlier than end time."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
}
/* Ensure start < end */
if
(
start
>
end
)
{
std
::
cout
<<
"Start time must be earlier than end time."
<<
std
::
endl
;
exit
(
EXIT_FAILURE
);
}
argcReal
-=
2
;
}
/* Build a list of sensornames */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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