Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9096533
feat: add decimal support to buffer
RaphDal Oct 10, 2025
74f6f62
docs: add decimal in rust examples
RaphDal Oct 10, 2025
3c87c76
docs: improve doc for decimal
RaphDal Oct 10, 2025
2883ea2
fix: restrict visibility of must_escape_unquoted to the crate only
RaphDal Oct 10, 2025
457b77a
fix: improve binary compatibility check
RaphDal Oct 10, 2025
3d8645b
fix: satisfy clippy with feature-gated usage of DECIMAL_BINARY_FORMAT…
RaphDal Oct 10, 2025
139e92d
docs: set diagram comment as text
RaphDal Oct 10, 2025
4bf9bfc
docs: removed unnecessary comment
RaphDal Oct 10, 2025
17f699b
docs: fix comment typo
RaphDal Oct 10, 2025
a583839
docs: fix buffer decimal examples
RaphDal Oct 10, 2025
c7f19af
feat: added support for C and C++
RaphDal Oct 10, 2025
6cc4237
fix: add missing error codes to C and C++ headers
RaphDal Oct 10, 2025
4aa3b14
fix: update type hints to include decimal in python test
RaphDal Oct 10, 2025
fb8ac1e
ci: trigger
RaphDal Oct 10, 2025
2095903
tests: add decimal support to ilp-client-interop-test
RaphDal Oct 13, 2025
984a236
feat: improve cpp decimal integration to cpp
RaphDal Oct 14, 2025
ce0fe17
typo: fix invalid comments
RaphDal Oct 14, 2025
d2ee26c
feat: add protocol version 3
RaphDal Oct 14, 2025
4c4b9af
revert: revert removal of implicit coercion of decimal binary views
RaphDal Oct 14, 2025
4a6a07c
feat: generalize array customization point
RaphDal Oct 14, 2025
cf425b5
typo: remove garbage
RaphDal Oct 14, 2025
2180a9f
docs: remove no longer true comment
RaphDal Oct 14, 2025
14b54eb
feat: improved decimal string validation
RaphDal Oct 15, 2025
fe7cceb
feat: add customization point for decimal
RaphDal Oct 15, 2025
44fe751
fix: accept more characters in decimal serializer for str to allow na…
RaphDal Oct 15, 2025
1b69994
tests: update test to use protocol version 3
RaphDal Oct 15, 2025
36f534e
docs: add decimal to c/cpp docs
RaphDal Oct 15, 2025
b11912a
tests: update rust examples to use protocol version 3
RaphDal Oct 15, 2025
147bab4
feat: add protocol version 3 to supported protocol versions
RaphDal Oct 15, 2025
77520ef
docs: add a simple description about the decimal datatype to ingress
RaphDal Oct 15, 2025
d9ef50d
fix: change port variable type to String for consistency
RaphDal Oct 15, 2025
6d19bd9
fix: change to_array_view_state_impl argument to const reference
RaphDal Oct 15, 2025
f47ee4f
fix: update usage message to line_sender_c_example_decimal_custom
RaphDal Oct 15, 2025
23d51b2
fix: remove unused includes from line_sender_array.hpp
RaphDal Oct 15, 2025
1f889e7
fix: update scale validation in DecimalSerializer to allow negative s…
RaphDal Oct 15, 2025
466b26d
fix: update protocol version to v3 in line_sender tests and header
RaphDal Oct 15, 2025
8dad866
fix: remove unused price_value assignment in line_sender_c_example_de…
RaphDal Oct 15, 2025
de1bba3
fix: update usage message to reflect correct example name in line_sen…
RaphDal Oct 15, 2025
12882be
fix: update price column type and correct table name in protocol_vers…
RaphDal Oct 15, 2025
cf1dd4d
Merge branch 'main' into rd_decimal
RaphDal Oct 15, 2025
f1624df
fix: free line sender buffer after flushing in example files
RaphDal Oct 16, 2025
9d564a8
fix: qualify binary_view with questdb::ingress::decimal namespace
RaphDal Oct 16, 2025
e63da89
fix: update protocol version to 2 in line sender examples
RaphDal Oct 16, 2025
ed83ff2
fix: update protocol version checks to use comparison operators
RaphDal Oct 17, 2025
ed7a984
fix: add PartialOrd to ProtocolVersion
RaphDal Oct 17, 2025
727cf09
fix: rename binary_view to decimal_view in decimal namespace
RaphDal Oct 17, 2025
d730bad
fix: remove supports method from ProtocolVersion implementation
RaphDal Oct 17, 2025
e6140e3
fix: clarify error messages for decimal scale and byte length limits
RaphDal Oct 17, 2025
1ebc6e6
typo: add missing definite article in ingress documentation
RaphDal Oct 17, 2025
0764846
fix: expose decimal_view in line_sender.hpp
RaphDal Oct 17, 2025
e2fa211
fix: cast ProtocolVersion to u8 for comparison in json_tests
RaphDal Oct 17, 2025
3bc2e3a
refactor: split headers
RaphDal Oct 17, 2025
17f2427
fix: improve error message for unsupported client protocol version
RaphDal Oct 17, 2025
af76951
Merge branch 'main' into rd_decimal
RaphDal Oct 17, 2025
9489414
fix: clarify implementation details for DecimalSerializer
RaphDal Oct 17, 2025
ba6744c
fix: correct wording in protocol version documentation for clarity
RaphDal Oct 17, 2025
61f16a7
fix: improve error messages for decimal scale and value length constr…
RaphDal Oct 17, 2025
61ff7ec
fix: correct order of fields in binary serialization format documenta…
RaphDal Oct 17, 2025
59cb32e
Merge branch 'main' into rd_decimal
RaphDal Oct 17, 2025
b2cedfd
fix: handle null data in line_sender_buffer_column_dec function
RaphDal Oct 17, 2025
1ede6d7
fix: remove debug output for protocol version in SenderBuilder
RaphDal Oct 17, 2025
e86a18d
fix: update usage message to include program name in help output
RaphDal Oct 17, 2025
5b17715
fix: use http instead of tcp in decimal examples
RaphDal Oct 17, 2025
76104aa
refactor: replace DecimalSerializer with DecimalView
RaphDal Oct 21, 2025
fec2164
test: add tests for NaN and Infinity decimal representations
RaphDal Oct 21, 2025
dfb9fd4
fix: correct spelling of 'Infinity' in validation comments
RaphDal Oct 21, 2025
23329b0
fix: improve error message for invalid decimal strings
RaphDal Oct 21, 2025
73d9f0d
fix: correct scale type in DecimalView conversion
RaphDal Oct 21, 2025
7af54e1
fix: update run_all_tests.py to include --force-max-version flag and …
RaphDal Nov 5, 2025
a2e9fbc
test: add check for decimal support in QuestDB version
RaphDal Nov 6, 2025
8ba6114
remove irrelevant test
RaphDal Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ if (QUESTDB_TESTS_AND_EXAMPLES)
compile_example(
line_sender_c_example_from_env
examples/line_sender_c_example_from_env.c)
compile_example(
line_sender_c_example_decimal_binary
examples/concat.c
examples/line_sender_c_example_decimal_binary.c)
compile_example(
line_sender_cpp_example
examples/line_sender_cpp_example.cpp)
Expand Down Expand Up @@ -165,6 +169,12 @@ if (QUESTDB_TESTS_AND_EXAMPLES)
compile_example(
line_sender_cpp_example_from_env
examples/line_sender_cpp_example_from_env.cpp)
compile_example(
line_sender_cpp_example_decimal_custom
examples/line_sender_cpp_example_decimal_custom.cpp)
compile_example(
line_sender_cpp_example_decimal_binary
examples/line_sender_cpp_example_decimal_binary.cpp)

# Include Rust tests as part of the tests run
add_test(
Expand Down
2 changes: 1 addition & 1 deletion ci/run_all_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def main():
run_cmd(str(test_line_sender_path))
run_cmd(str(test_line_sender_path_CXX20))
run_cmd('python3', str(system_test_path), 'run', '--versions', qdb_v, '-v')
#run_cmd('python3', str(system_test_path), 'run', '--repo', './questdb', '-v')
run_cmd('python3', str(system_test_path), 'run', '--repo', './questdb', '-v', '--force-max-version')


if __name__ == '__main__':
Expand Down
12 changes: 6 additions & 6 deletions ci/run_tests_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ stages:
displayName: "Build Rust examples"
############################# temp for test begin #####################
- script: |
git clone --depth 1 https://github.com/questdb/questdb.git ./questdb
git clone --depth 1 --branch rd_decimal_integration https://github.com/questdb/questdb.git ./questdb
displayName: git clone questdb
- task: Maven@3
displayName: "Compile QuestDB"
inputs:
mavenPOMFile: "questdb/pom.xml"
jdkVersionOption: "1.17"
options: "-DskipTests -Pbuild-web-console"
############################# temp for test end #####################
############################# temp for test end #####################
Comment on lines 57 to +67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Address the temporary QuestDB branch before merging.

The hard-coded branch reference rd_decimal_integration (Line 59) is wrapped in temporary test markers. This configuration must not reach main without resolution. The PR is labeled "DO NOT MERGE," but the intent here is unclear:

  1. Should this be reverted to clone the default branch once the tandem PR (feat(core): support for Decimal questdb#6068) is merged?
  2. Or is this a permanent integration point that should be updated to reference a stable branch/tag?

Clarify the post-merge handling for this branch reference.


🏁 Script executed:

#!/bin/bash
# Inspect the full ci/run_tests_pipeline.yaml file to verify temporary markers and quote style patterns
cat ci/run_tests_pipeline.yaml

Length of output: 4789


🏁 Script executed:

#!/bin/bash
# Search for any other references to rd_decimal_integration or temporary test markers in the repo
rg -n "rd_decimal_integration|temp for test" --type=yaml

Length of output: 366


🏁 Script executed:

#!/bin/bash
# Check Git history to see if this branch reference or temporary markers were recently added
git log --oneline -n 20 -- ci/run_tests_pipeline.yaml

Length of output: 1038


🏁 Script executed:

#!/bin/bash
# Search for documentation or README mentioning decimal integration or temporary testing
rg -i "decimal|rd_decimal_integration" --type=md --type=txt

Length of output: 1423


🏁 Script executed:

#!/bin/bash
# Check the actual diff/commit to see what changes were made
git show 7af54e1 -- ci/run_tests_pipeline.yaml | head -100

Length of output: 2345


🏁 Script executed:

#!/bin/bash
# Look for any pull request metadata or configuration that mentions "DO NOT MERGE" or decimal
find . -maxdepth 2 -name "*.md" -o -name "*.yml" -o -name "*.yaml" | xargs grep -l "DO NOT MERGE\|decimal" 2>/dev/null | head -10

Length of output: 52


Remove the temporary QuestDB branch reference before merging.

The hard-coded branch rd_decimal_integration (line 59) is marked with temporary test comments and must not reach main without resolution.

Action required: Clarify the post-merge handling—will this branch be merged into QuestDB's main, or should the reference be reverted to the default branch once the tandem PR (questdb/questdb#6068) is resolved?

🤖 Prompt for AI Agents
ci/run_tests_pipeline.yaml around lines 57 to 67: the pipeline is hard-coded to
clone the temporary branch rd_decimal_integration for QuestDB (marked by temp
comments) which must not be merged to main; replace the explicit branch
reference with the repository's default branch (or a pipeline variable like
QUESTDB_BRANCH) and remove the temporary test markers, or add a clear TODO and
conditional that only uses rd_decimal_integration for CI runs tied to the tandem
PR; ensure the final change either reverts to the default branch (e.g., main) or
parameterizes the branch and documents the post-merge action referencing
questdb/questdb#6068 so the temporary branch isn't left in main.

- script: python3 ci/run_all_tests.py
env:
JAVA_HOME: $(JAVA_HOME_11_X64)
Expand All @@ -76,7 +76,7 @@ stages:
- job: FormatAndLinting
displayName: "cargo fmt and clippy"
pool:
vmImage: 'ubuntu-latest'
vmImage: "ubuntu-latest"
timeoutInMinutes: 10
steps:
- checkout: self
Expand Down Expand Up @@ -117,7 +117,7 @@ stages:
- job: TestVsQuestDBMaster
displayName: "Vs QuestDB 'master'"
pool:
vmImage: 'ubuntu-latest'
vmImage: "ubuntu-latest"
timeoutInMinutes: 60
steps:
- checkout: self
Expand All @@ -131,8 +131,8 @@ stages:
- task: Maven@3
displayName: "Compile QuestDB"
inputs:
mavenPOMFile: 'questdb/pom.xml'
jdkVersionOption: '1.17'
mavenPOMFile: "questdb/pom.xml"
jdkVersionOption: "1.17"
options: "-DskipTests -Pbuild-web-console"
- script: |
python3 system_test/test.py run --repo ./questdb -v
Expand Down
81 changes: 42 additions & 39 deletions cpp_test/test_line_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,36 +196,39 @@ TEST_CASE("line_sender c api basics")
2.7,
48121.5,
4.3};
CHECK(::line_sender_buffer_column_f64_arr_byte_strides(
buffer,
arr_name,
rank,
shape,
strides,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_byte_strides(
buffer,
arr_name,
rank,
shape,
strides,
arr_data.data(),
arr_data.size(),
&err));

line_sender_column_name arr_name2 = QDB_COLUMN_NAME_LITERAL("a2");
intptr_t elem_strides[] = {6, 2, 1};
CHECK(::line_sender_buffer_column_f64_arr_elem_strides(
buffer,
arr_name2,
rank,
shape,
elem_strides,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_elem_strides(
buffer,
arr_name2,
rank,
shape,
elem_strides,
arr_data.data(),
arr_data.size(),
&err));
line_sender_column_name arr_name3 = QDB_COLUMN_NAME_LITERAL("a3");
CHECK(::line_sender_buffer_column_f64_arr_c_major(
buffer,
arr_name3,
rank,
shape,
arr_data.data(),
arr_data.size(),
&err));
CHECK(
::line_sender_buffer_column_f64_arr_c_major(
buffer,
arr_name3,
rank,
shape,
arr_data.data(),
arr_data.size(),
&err));
CHECK(::line_sender_buffer_at_nanos(buffer, 10000000, &err));
CHECK(server.recv() == 0);
CHECK(::line_sender_buffer_size(buffer) == 383);
Expand Down Expand Up @@ -282,7 +285,7 @@ TEST_CASE("line_sender c++ api basics")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -352,7 +355,7 @@ TEST_CASE("line_sender array vector API")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -396,7 +399,7 @@ TEST_CASE("line_sender array span API")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down Expand Up @@ -443,7 +446,7 @@ TEST_CASE("test multiple lines")
questdb::ingress::test::mock_server server;
std::string conf_str =
"tcp::addr=127.0.0.1:" + std::to_string(server.port()) +
";protocol_version=2;";
";protocol_version=3;";
questdb::ingress::line_sender sender =
questdb::ingress::line_sender::from_conf(conf_str);
CHECK_FALSE(sender.must_close());
Expand Down Expand Up @@ -1061,21 +1064,21 @@ TEST_CASE("Moved View")
TEST_CASE("Empty Buffer")
{
questdb::ingress::line_sender_buffer b1{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
CHECK(b1.size() == 0);
questdb::ingress::line_sender_buffer b2{std::move(b1)};
CHECK(b1.size() == 0);
CHECK(b2.size() == 0);
questdb::ingress::line_sender_buffer b3{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b3 = std::move(b2);
CHECK(b2.size() == 0);
CHECK(b3.size() == 0);
questdb::ingress::line_sender_buffer b4{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b4.table("test").symbol("a", "b").at_now();
questdb::ingress::line_sender_buffer b5{
questdb::ingress::protocol_version::v2};
questdb::ingress::protocol_version::v3};
b5 = std::move(b4);
CHECK(b4.size() == 0);
CHECK(b5.size() == 9);
Expand Down Expand Up @@ -1111,19 +1114,19 @@ TEST_CASE("HTTP basics")
questdb::ingress::protocol::http, "127.0.0.1", 1};
questdb::ingress::opts opts1conf = questdb::ingress::opts::from_conf(
"http::addr=127.0.0.1:1;username=user;password=pass;request_timeout="
"5000;retry_timeout=5;protocol_version=2;");
"5000;retry_timeout=5;protocol_version=3;");
questdb::ingress::opts opts2{
questdb::ingress::protocol::https, "localhost", "1"};
questdb::ingress::opts opts2conf = questdb::ingress::opts::from_conf(
"http::addr=127.0.0.1:1;token=token;request_min_throughput=1000;retry_"
"timeout=0;protocol_version=2;");
opts1.protocol_version(questdb::ingress::protocol_version::v2)
"timeout=0;protocol_version=3;");
opts1.protocol_version(questdb::ingress::protocol_version::v3)
.username("user")
.password("pass")
.max_buf_size(1000000)
.request_timeout(5000)
.retry_timeout(5);
opts2.protocol_version(questdb::ingress::protocol_version::v2)
opts2.protocol_version(questdb::ingress::protocol_version::v3)
.token("token")
.request_min_throughput(1000)
.retry_timeout(0);
Expand Down Expand Up @@ -1180,7 +1183,7 @@ TEST_CASE("line sender protocol version v2")
questdb::ingress::protocol::tcp,
std::string("127.0.0.1"),
std::to_string(server.port())};
opts.protocol_version(questdb::ingress::protocol_version::v2);
opts.protocol_version(questdb::ingress::protocol_version::v3);
questdb::ingress::line_sender sender{opts};
CHECK_FALSE(sender.must_close());
server.accept();
Expand Down
8 changes: 7 additions & 1 deletion doc/C.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- [Array with element strides](../examples/line_sender_c_example_array_elem_strides.c)
- [Array in C-major order](../examples/line_sender_c_example_array_c_major.c)

**Decimal**
- [Decimal in binary format](../examples/line_sender_c_example_decimal_binary.c)

## API Overview

### Header
Expand Down Expand Up @@ -90,7 +93,9 @@ line_sender_utf8 symbol_value = QDB_UTF8_LITERAL("ETH-USD");
if (!line_sender_buffer_symbol(buffer, symbol_name, symbol_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_at_nanos(buffer, line_sender_now_nanos(), &err))
Expand All @@ -101,6 +106,7 @@ if (!line_sender_buffer_at_nanos(buffer, line_sender_now_nanos(), &err))
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
```

Expand Down
6 changes: 5 additions & 1 deletion doc/CPP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
- [Array in C-major order](../examples/line_sender_cpp_example_array_c_major.cpp)
- [Custom array type integration](../examples/line_sender_cpp_example_array_custom.cpp)

**Decimal**
- [Decimal in binary format](../examples/line_sender_cpp_example_decimal_binary.cpp)
- [Custom decimal type integration](../examples/line_sender_cpp_example_decimal_custom.cpp)

## API Overview

### Header
Expand Down Expand Up @@ -76,7 +80,7 @@ questdb::ingress::line_sender_buffer buffer;
buffer
.table("trades")
.symbol("symbol", "ETH-USD")
.column("price", 2615.54)
.column("price", "2615.54"_decimal)
.at(timestamp_nanos::now());

// To insert more records, call `buffer.table(..)...` again.
Expand Down
7 changes: 5 additions & 2 deletions examples/line_sender_c_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -51,7 +51,9 @@ static bool example(const char* host, const char* port)
if (!line_sender_buffer_symbol(buffer, side_name, side_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, amount_name, 0.00044, &err))
Expand All @@ -72,6 +74,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);

return true;
Expand Down
1 change: 1 addition & 0 deletions examples/line_sender_c_example_array_byte_strides.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
3 changes: 2 additions & 1 deletion examples/line_sender_c_example_array_c_major.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -79,6 +79,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
3 changes: 2 additions & 1 deletion examples/line_sender_c_example_array_elem_strides.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static bool example(const char* host, const char* port)
line_sender* sender = NULL;
line_sender_buffer* buffer = NULL;
char* conf_str =
concat("tcp::addr=", host, ":", port, ";protocol_version=2;");
concat("tcp::addr=", host, ":", port, ";protocol_version=3;");
if (!conf_str)
{
fprintf(stderr, "Could not concatenate configuration string.\n");
Expand Down Expand Up @@ -82,6 +82,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);
return true;

Expand Down
7 changes: 5 additions & 2 deletions examples/line_sender_c_example_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static bool example(const char* host, const char* port)
":",
port,
";"
"protocol_version=2;"
"protocol_version=3;"
"username=admin;"
"token=5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48;"
"token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU;"
Expand Down Expand Up @@ -60,7 +60,9 @@ static bool example(const char* host, const char* port)
if (!line_sender_buffer_symbol(buffer, side_name, side_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, price_name, 2615.54, &err))
line_sender_utf8 price_value = QDB_UTF8_LITERAL("2615.54");
if (!line_sender_buffer_column_dec_str(
buffer, price_name, price_value, &err))
goto on_error;

if (!line_sender_buffer_column_f64(buffer, amount_name, 0.00044, &err))
Expand All @@ -81,6 +83,7 @@ static bool example(const char* host, const char* port)
if (!line_sender_flush(sender, buffer, &err))
goto on_error;

line_sender_buffer_free(buffer);
line_sender_close(sender);

return true;
Expand Down
Loading