influxdb-cxx
influxdb-cxx copied to clipboard
An error occurred when I query the database
My Code:
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086/?db=test");
std::vector<influxdb::Point> points = influxdb->query("SELECT * FROM test");
cout << points.size() << endl;
And this is the structure of measurement "test":
select *from test
name: test
time host value
---- ---- -----
1583938657323591874 localhost 10
1583938681385599260 localhost 10
Error message:
g++ QueryTest.cc -o QueryTest -std=c++17 -lInfluxDB
./QueryTest
terminate called after throwing an instance of '
boost::wrapexcept<boost::property_tree::json_parser::json_parser_error>' what(): <unspecified file>(1): garbage after data
Aborted (core dumped)
This is my environment:
gcc 7.3
boost 1.72.0
curl 7.69.1
What should I do to solve this problem, thanks.
Sorry missed that, I'll take a look tomorrow!
Are you sure your database name is test
as well? Because you only showed that your measurement name = test
.
Could you also try running ./bin/testQuery
and lemme know what the output is?
Are you sure your database name is
test
as well? Because you only showed that your measurement name =test
. Could you also try running./bin/testQuery
and lemme know what the output is?
Yes, the database is 'test'. The result of testQuery is as follows:
root@ubuntu:/home/SourceCode/influxdb-cxx/build/bin# ls
benchmark testFactory testHttp testPoint testQuery testUdp
root@ubuntu:/home/SourceCode/influxdb-cxx/build/bin# ./testQuery
Running 1 test case...
unknown location(0): fatal error: in "query1": std::logic_error: basic_string::_M_construct null not valid
/home/SourceCode/influxdb-cxx/test/testQuery.cxx(18): last checkpoint
*** 1 failure is detected in the test module "Test InfluxDB Query"
Thanks :-)
Could you try with v0.5.0
?
Could you try with
v0.5.0
?
I have sent a mail to your mailbox, please check it.