Skip to content

Commit

Permalink
Clean up PR #24141
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam committed Mar 12, 2021
1 parent 79e4811 commit ed2b50d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.Data.Sqlite.Core/SqliteDataRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class SqliteDataRecord : SqliteValueReader, IDisposable
private byte[][]? _blobCache;
private int?[]? _typeCache;
private Dictionary<string, int>? _columnNameOrdinalCache;
private string?[]? _columnNameCache;
private string[]? _columnNameCache;
private bool _stepped;
private int? _rowidOrdinal;

Expand Down Expand Up @@ -112,7 +112,7 @@ public virtual string GetName(int ordinal)
}

_columnNameCache ??= new string[FieldCount];
_columnNameCache[ordinal] = name;
_columnNameCache[ordinal] = name!;

return name!;
}
Expand Down
12 changes: 6 additions & 6 deletions test/Microsoft.Data.Sqlite.Tests/SqliteDataReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,8 @@ public void GetName_works()
using (var reader = connection.ExecuteReader("SELECT 1 AS Id;"))
{
Assert.Equal("Id", reader.GetName(0));
// Repeated access might use caching.

// NB: Repeated to use caching
Assert.Equal("Id", reader.GetName(0));
}
}
Expand Down Expand Up @@ -1265,12 +1266,12 @@ public void GetOrdinal_works()
{
connection.Open();

using (var reader = connection.ExecuteReader("SELECT 1 as Id, 'ÆØÅ' AS Value"))
using (var reader = connection.ExecuteReader("SELECT 1 AS Id;"))
{
Assert.Equal(0, reader.GetOrdinal("Id"));
Assert.Equal(1, reader.GetOrdinal("Value"));
// Repeated access may use caching
Assert.Equal(1, reader.GetOrdinal("Value"));

// NB: Repeated to use caching
Assert.Equal(0, reader.GetOrdinal("Id"));
}
}
}
Expand Down Expand Up @@ -1302,7 +1303,6 @@ public void GetOrdinal_throws_when_closed()
public void GetOrdinal_throws_when_non_query()
=> X_throws_when_non_query(r => r.GetOrdinal("dummy"));


[Fact]
public void GetString_works_utf8()
=> GetX_works(
Expand Down

0 comments on commit ed2b50d

Please sign in to comment.