Skip to content

Commit 3a51706

Browse files
authored
fix: fix protocol exception when sending Nullable<long> with QuestDB v 9.1.0
1 parent 939350d commit 3a51706

File tree

9 files changed

+426
-350
lines changed

9 files changed

+426
-350
lines changed

src/example-basic/Program.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
using System;
22
using QuestDB;
33

4-
using var sender = Sender.New("http::addr=localhost:9000;");
4+
using var sender = Sender.New("http::addr=localhost:9000;protocol_version=3");
55
await sender.Table("trades")
6-
.Symbol("symbol", "ETH-USD")
7-
.Symbol("side", "sell")
8-
.Column("price", 2615.54)
9-
.Column("amount", 0.00044)
10-
.AtAsync(DateTime.UtcNow);
6+
.Symbol("symbol", "ETH-USD")
7+
.Symbol("side", "sell")
8+
.Column("price", 2615.54)
9+
.Column("amount", 0.00044)
10+
.AtAsync(DateTime.UtcNow);
1111

1212
await sender.Table("trades")
13-
.Symbol("symbol", "BTC-USD")
14-
.Symbol("side", "sell")
15-
.Column("price", 39269.98)
16-
.Column("amount", 0.001)
17-
.AtAsync(DateTime.UtcNow);
13+
.Symbol("symbol", "BTC-USD")
14+
.Symbol("side", "sell")
15+
.Column("price", 39269.98)
16+
.Column("amount", 0.001)
17+
.AtAsync(DateTime.UtcNow);
1818

19-
await sender.SendAsync();
19+
await sender.SendAsync();

src/net-questdb-client-tests/HttpTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ await sender.Table("metrics")
101101
.Symbol("tag", "value")
102102
.Column("dec_pos", 123.45m)
103103
.Column("dec_neg", -123.45m)
104-
.Column("dec_null", (decimal?)null)
104+
.NullableColumn("dec_null", (decimal?)null)
105105
.Column("dec_max", decimal.MaxValue)
106106
.Column("dec_min", decimal.MinValue)
107107
.AtAsync(new DateTime(1970, 01, 01, 0, 0, 1));
@@ -1233,7 +1233,6 @@ public async Task CancelLineAfterError()
12331233
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
12341234
}
12351235

1236-
12371236
[Test]
12381237
public async Task CannotConnect()
12391238
{

src/net-questdb-client-tests/JsonSpecTestRunner.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class JsonSpecTestRunner
4545
private static readonly TestCase[]? TestCases = ReadTestCases();
4646

4747
/// <summary>
48-
/// Populate the provided sender with the test case's table, symbols, and columns, then send the prepared row.
48+
/// Populate the provided sender with the test case's table, symbols, and columns, then send the prepared row.
4949
/// </summary>
5050
/// <param name="sender">The ISender to configure and use for sending the test case row.</param>
5151
/// <param name="testCase">The test case containing table name, symbols, and typed columns to write.</param>
@@ -82,13 +82,14 @@ private static async Task ExecuteTestCase(ISender sender, TestCase testCase)
8282
var value = ((JsonElement)column.Value).GetString();
8383
if (value is null)
8484
{
85-
sender.Column(column.Name, (decimal?)null);
85+
sender.NullableColumn(column.Name, (decimal?)null);
8686
}
8787
else
8888
{
8989
var d = decimal.Parse(value, NumberStyles.Number, CultureInfo.InvariantCulture);
9090
sender.Column(column.Name, d);
9191
}
92+
9293
break;
9394

9495
default:
@@ -103,9 +104,13 @@ private static async Task ExecuteTestCase(ISender sender, TestCase testCase)
103104
}
104105

105106
/// <summary>
106-
/// Executes the provided test case by sending its configured table, symbols, and columns to a local TCP listener and asserting the listener's received output against the test case's expected result.
107+
/// Executes the provided test case by sending its configured table, symbols, and columns to a local TCP listener and
108+
/// asserting the listener's received output against the test case's expected result.
107109
/// </summary>
108-
/// <param name="testCase">The test case to run; provides table, symbols, columns to send and a Result describing the expected validation (Status, Line, AnyLines, or BinaryBase64).</param>
110+
/// <param name="testCase">
111+
/// The test case to run; provides table, symbols, columns to send and a Result describing the
112+
/// expected validation (Status, Line, AnyLines, or BinaryBase64).
113+
/// </param>
109114
[TestCaseSource(nameof(TestCases))]
110115
public async Task RunTcp(TestCase testCase)
111116
{
@@ -162,9 +167,13 @@ public async Task RunTcp(TestCase testCase)
162167
}
163168

164169
/// <summary>
165-
/// Executes the provided test case by sending data over HTTP to a dummy server using a QuestDB sender and validates the server's response according to the test case result.
170+
/// Executes the provided test case by sending data over HTTP to a dummy server using a QuestDB sender and validates
171+
/// the server's response according to the test case result.
166172
/// </summary>
167-
/// <param name="testCase">The test case describing table, symbols, columns, and expected result (status, line(s), or base64 binary) to execute and validate.</param>
173+
/// <param name="testCase">
174+
/// The test case describing table, symbols, columns, and expected result (status, line(s), or
175+
/// base64 binary) to execute and validate.
176+
/// </param>
168177
[TestCaseSource(nameof(TestCases))]
169178
public async Task RunHttp(TestCase testCase)
170179
{
@@ -293,7 +302,7 @@ public class TestCase
293302
[JsonPropertyName("result")] public TestCaseResult Result { get; set; } = null!;
294303

295304
/// <summary>
296-
/// Provides the test case name for display and logging.
305+
/// Provides the test case name for display and logging.
297306
/// </summary>
298307
/// <returns>The TestName of the test case.</returns>
299308
public override string ToString()

0 commit comments

Comments
 (0)