Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions src/net-questdb-client-tests/HttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,33 @@ public async Task CancelLine()
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}


[Test]
public async Task CancelLineAfterClear()
{
using var srv = new DummyHttpServer();
await srv.StartAsync(HttpPort);
using var sender = Sender.New($"http::addr={Host}:{HttpPort};auto_flush=off;");

sender.Table("good");
sender.Symbol("asdf", "sdfad");
sender.Column("ddd", 123);
sender.At(new DateTime(1970, 1, 2));

sender.Table("bad");
sender.Symbol("asdf", "sdfad");
sender.Column("asdf", 123);
sender.Clear();
sender.CancelRow();

sender.Table("good");
await sender.AtAsync(new DateTime(1970, 1, 2));
await sender.SendAsync();

var expected = "good 86400000000000\n";
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}

[Test]
public async Task CannotConnect()
{
Expand Down
12 changes: 7 additions & 5 deletions src/net-questdb-client/Buffers/BufferV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ public void Clear()
_buffers[i] = (_buffers[i].Buffer, 0);
}

Position = 0;
RowCount = 0;
Length = 0;
WithinTransaction = false;
_currentTableName = "";
Position = 0;
RowCount = 0;
Length = 0;
WithinTransaction = false;
_currentTableName = "";
_lineStartBufferIndex = 0;
_lineStartBufferPosition = 0;
}

/// <inheritdoc />
Expand Down