Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
31009e8c
Commit
31009e8c
authored
Aug 06, 2020
by
Michael Ott
Browse files
Remove -d parameter for queries
parent
4d191371
Changes
3
Hide whitespace changes
Inline
Side-by-side
tools/dcdbquery/dcdbquery.cpp
View file @
31009e8c
...
...
@@ -54,7 +54,6 @@ void usage(void)
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Options:"
<<
std
::
endl
;
std
::
cout
<<
" -h<host> Cassandra host [default: "
<<
DEFAULT_CASSANDRAHOST
<<
":"
<<
DEFAULT_CASSANDRAPORT
<<
"]"
<<
endl
;
std
::
cout
<<
" -d Don't look up sensor name"
<<
std
::
endl
;
std
::
cout
<<
" -r Report timestamps in numerical format"
<<
std
::
endl
;
std
::
cout
<<
" -l Report times in local time (not UTC)"
<<
std
::
endl
;
}
...
...
@@ -111,18 +110,14 @@ int main(int argc, char * const argv[])
myQuery
=
new
DCDBQuery
();
/* Get the options */
bool
direct
=
false
;
int
ret
;
const
char
*
host
=
getenv
(
"DCDB_HOSTNAME"
);
if
(
!
host
)
{
host
=
"localhost"
;
}
while
((
ret
=
getopt
(
argcReal
,
argvReal
,
"+h:
d
rlf"
))
!=-
1
)
{
while
((
ret
=
getopt
(
argcReal
,
argvReal
,
"+h:rlf"
))
!=-
1
)
{
switch
(
ret
)
{
case
'd'
:
direct
=
true
;
break
;
case
'h'
:
host
=
optarg
;
break
;
...
...
@@ -162,7 +157,7 @@ int main(int argc, char * const argv[])
sensors
.
push_back
(
argvReal
[
arg
]);
}
myQuery
->
doQuery
(
host
,
sensors
,
start
,
end
,
direct
);
myQuery
->
doQuery
(
host
,
sensors
,
start
,
end
);
delete
myQuery
;
...
...
tools/dcdbquery/query.cpp
View file @
31009e8c
...
...
@@ -205,7 +205,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
}
}
void
DCDBQuery
::
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
,
bool
direct
)
void
DCDBQuery
::
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
)
{
/* Create a new connection to the database */
connection
=
new
DCDB
::
Connection
();
...
...
@@ -267,17 +267,18 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC
queryCfg
.
unit
=
DCDB
::
UnitConv
::
fromString
(
modifierStr
);
}
}
if
(
!
direct
)
{
std
::
list
<
DCDB
::
PublicSensor
>
publicSensors
;
sensorConfig
.
getPublicSensorsByWildcard
(
publicSensors
,
sensorName
.
c_str
());
for
(
auto
sen
:
publicSensors
)
{
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
sen
,
queryCfg
));
}
}
else
{
DCDB
::
PublicSensor
pS
;
pS
.
name
=
sensorName
;
pS
.
pattern
=
sensorName
;
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
pS
,
queryCfg
));
std
::
list
<
DCDB
::
PublicSensor
>
publicSensors
;
sensorConfig
.
getPublicSensorsByWildcard
(
publicSensors
,
sensorName
.
c_str
());
if
(
publicSensors
.
size
()
>
0
)
{
for
(
auto
sen
:
publicSensors
)
{
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
sen
,
queryCfg
));
}
}
else
{
DCDB
::
PublicSensor
pS
;
pS
.
name
=
sensorName
;
pS
.
pattern
=
sensorName
;
queries
.
insert
(
std
::
pair
<
DCDB
::
PublicSensor
,
queryConfig_t
>
(
pS
,
queryCfg
));
}
}
}
...
...
tools/dcdbquery/query.h
View file @
31009e8c
...
...
@@ -88,7 +88,7 @@ public:
void
check
(
std
::
list
<
std
::
string
>::
iterator
it
,
double
*
scalingFactor
);
void
checkModifier
(
std
::
list
<
std
::
string
>::
iterator
it
,
struct
outputFormat
*
format
);
void
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
,
bool
direct
=
false
);
void
doQuery
(
const
char
*
hostname
,
std
::
list
<
std
::
string
>
sensors
,
DCDB
::
TimeStamp
start
,
DCDB
::
TimeStamp
end
);
DCDBQuery
();
virtual
~
DCDBQuery
()
{};
...
...
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