Skip to content

Commit

Permalink
[Hotfix 4.1.1] | Fix null binary rowversion and add test coverage (#1688
Browse files Browse the repository at this point in the history
) (#1712)
  • Loading branch information
DavoudEshtehari authored Aug 23, 2022
1 parent ea6e14c commit 5cca4a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ internal SqlBinary SqlBinary
{
if (StorageType.SqlBinary == _type)
{
if (IsNull)
{
return SqlBinary.Null;
}
return (SqlBinary)_object;
}
return (SqlBinary)SqlValue; // anything else we haven't thought of goes through boxing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ internal SqlBinary SqlBinary
{
if (StorageType.SqlBinary == _type)
{
if (IsNull)
{
return SqlBinary.Null;
}
return (SqlBinary)_object;
}
return (SqlBinary)SqlValue; // anything else we haven't thought of goes through boxing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ public static void CheckNullRowVersionIsBDNull()
Assert.IsType<DBNull>(result);
Assert.Equal(result, reader.GetFieldValue<DBNull>(0));
Assert.Throws<SqlNullValueException>(() => reader.GetFieldValue<byte[]>(0));

SqlBinary binary = reader.GetSqlBinary(0);
Assert.True(binary.IsNull);

SqlBytes bytes = reader.GetSqlBytes(0);
Assert.True(bytes.IsNull);
Assert.Null(bytes.Buffer);

}
finally
{
Expand Down

0 comments on commit 5cca4a7

Please sign in to comment.