Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

An error occurred when I query the database #57

Open
cqfive opened this issue Mar 18, 2020 · 5 comments
Open

An error occurred when I query the database #57

cqfive opened this issue Mar 18, 2020 · 5 comments

Comments

@cqfive
Copy link

cqfive commented Mar 18, 2020

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.

@awegrzyn
Copy link
Owner

Sorry missed that, I'll take a look tomorrow!

@awegrzyn
Copy link
Owner

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?

@cqfive
Copy link
Author

cqfive commented Mar 21, 2020

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 :-)

@awegrzyn
Copy link
Owner

Could you try with v0.5.0 ?

@cqfive
Copy link
Author

cqfive commented Mar 21, 2020

Could you try with v0.5.0 ?

I have sent a mail to your mailbox, please check it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants