Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string and double not working #161

Closed
ronytigo opened this issue Jan 28, 2023 · 12 comments
Closed

string and double not working #161

ronytigo opened this issue Jan 28, 2023 · 12 comments
Labels

Comments

@ronytigo
Copy link

ronytigo commented Jan 28, 2023

double test = 3.33;
point.addField("value", test);

and

point.addField("value", "test");

don't work.

int32_t test = 10;
point.addField("value", test);

Does work and I see the data in the db.

@offa offa added the question label Jan 28, 2023
@offa
Copy link
Owner

offa commented Jan 28, 2023

(As mentioned in the other ticket) Please verify the unit tests work on your system (eg. make unittest). There are tests for all supported types.

Do you have a minimal example to reproduce the issue? And what kind of error do you get?

@ronytigo
Copy link
Author

I tried make unitttest (sure it's with 3 't'?) in the root folder and in the test folder. I get:
make: *** No rule to make target 'unittest'. Stop.

@ronytigo
Copy link
Author

double test = 3.33;
point.addField("value", test);
influx_client->write(std::move(point));

influx-cxx [treatCurlResponse]: Bad request: 422

@ronytigo
Copy link
Author

I print the lines in the batch before sending them:

meas value=3.333000000000000185 1674934678110483221
meas value=3.333000000000000185 1674934678120823930

@offa
Copy link
Owner

offa commented Jan 28, 2023

I tried make unitttest (sure it's with 3 't'?) in the root folder and in the test folder. I get: make: *** No rule to make target 'unittest'. Stop.

You are right, it's unittest (with 2x 't') :-)

It's necessary to run it within your build directory as it's a make target. Note: Tests need to be enabled (aka. not disabled).

@offa
Copy link
Owner

offa commented Jan 28, 2023

One more thing you should try: Write to new an completely fresh database.

@ronytigo
Copy link
Author

yeah I also tried unittest and also from my build folder, but I don't know how to not disable the tests. I just cloned the project and added this to my CMakeLists.txt file:

add_subdirectory(deps/influxdb-cxx)
target_link_libraries(rony_test PRIVATE InfluxData::InfluxDB)
set(INFLUXCXX_WITH_BOOST OFF)

@offa
Copy link
Owner

offa commented Jan 28, 2023

I see, tests are disabled if included as subdirectory. So it might be easier to test a minimal example with a fresh database first.

@ronytigo
Copy link
Author

writing to a new bucket worked for double and didn't work for string. then another new bucket worked for string.
why is that? and how can it be fixed?

@offa
Copy link
Owner

offa commented Jan 28, 2023

Are you mixing types within the same field?

@ronytigo
Copy link
Author

ah, yes, I use the same measurement for the different types. I'll try different ones!

@ronytigo
Copy link
Author

seems to work, thanks!

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

No branches or pull requests

2 participants