Skip to content

Commit 5b31219

Browse files
committed
Revert "Fix sequential text reader bug and add covering test (#3383)"
This reverts commit 97be747.
1 parent 9b5cde6 commit 5b31219

File tree

2 files changed

+1
-55
lines changed

2 files changed

+1
-55
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlSequentialTextReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public override Task<int> ReadAsync(char[] buffer, int index, int count)
172172
byte[] byteBuffer = PrepareByteBuffer(charsNeeded, out int byteBufferUsed);
173173

174174
// Permit a 0 byte read in order to advance the reader to the correct column
175-
if (byteBufferUsed <= byteBuffer.Length || byteBuffer.Length == 0)
175+
if ((byteBufferUsed < byteBuffer.Length) || (byteBuffer.Length == 0))
176176
{
177177
SqlDataReader reader = _reader;
178178
if (reader != null)

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -593,60 +593,6 @@ integrated into a comprehensive development
593593
}
594594
}
595595

596-
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
597-
public static async Task CanReadSequentialDecreasingChunks()
598-
{
599-
// pattern repeat input allows you to more easily identify if chunks are incorrectly
600-
// related to each other by seeing the start and end of sequential chunks and checking
601-
// if they correctly move to the next char while debugging
602-
// simply repeating a single char can't tell you where in the string it went wrong.
603-
const string baseString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
604-
StringBuilder inputBuilder = new StringBuilder();
605-
while (inputBuilder.Length < (64 * 1024))
606-
{
607-
inputBuilder.Append(baseString);
608-
inputBuilder.Append(' ');
609-
}
610-
611-
string input = inputBuilder.ToString();
612-
613-
StringBuilder resultBuilder = new StringBuilder();
614-
CancellationTokenSource cts = new CancellationTokenSource();
615-
using (var connection = new SqlConnection(DataTestUtility.TCPConnectionString))
616-
{
617-
await connection.OpenAsync(cts.Token);
618-
619-
using (var command = connection.CreateCommand())
620-
{
621-
command.CommandText = "SELECT CONVERT(varchar(max),@str) as a";
622-
command.Parameters.AddWithValue("@str", input);
623-
624-
using (var reader = await command.ExecuteReaderAsync(CommandBehavior.SequentialAccess, cts.Token))
625-
{
626-
if (await reader.ReadAsync(cts.Token))
627-
{
628-
using (var textReader = reader.GetTextReader(0))
629-
{
630-
var buffer = new char[4096];
631-
var charsReadCount = -1;
632-
var start = 0;
633-
while (charsReadCount != 0)
634-
{
635-
charsReadCount = await textReader.ReadAsync(buffer, start, buffer.Length - start);
636-
resultBuilder.Append(buffer, start, charsReadCount);
637-
start++;
638-
}
639-
}
640-
}
641-
}
642-
}
643-
}
644-
645-
string result = resultBuilder.ToString();
646-
647-
Assert.Equal(input, result);
648-
}
649-
650596
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
651597
public static async Task CanReadBinaryData()
652598
{

0 commit comments

Comments
 (0)