Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
la-we committed Nov 7, 2024
1 parent 8a864c8 commit f8b8049
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
21 changes: 18 additions & 3 deletions src/FirebirdSql.Data.FirebirdClient/Client/Native/FesBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ public override void GetSegment(Stream stream)
requested,
tmp);


RblRemoveValue(IscCodes.RBL_segment);

if (_statusVector[1] == new IntPtr(IscCodes.isc_segstr_eof))
Expand Down Expand Up @@ -317,7 +316,15 @@ public override byte[] GetSegment()
_database.ProcessStatusVector(_statusVector);
}

return tmp;
var actualSegment = tmp;
if (actualSegment.Length != segmentLength)
{
tmp = new byte[segmentLength];
Array.Copy(actualSegment, tmp, segmentLength);
actualSegment = tmp;
}

return actualSegment;
}
public override ValueTask<byte[]> GetSegmentAsync(CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -355,7 +362,15 @@ public override ValueTask<byte[]> GetSegmentAsync(CancellationToken cancellation
}
}

return ValueTask2.FromResult(tmp);
var actualSegment = tmp;
if (actualSegment.Length != segmentLength)
{
tmp = new byte[segmentLength];
Array.Copy(actualSegment, tmp, segmentLength);
actualSegment = tmp;
}

return ValueTask2.FromResult(actualSegment);
}

public override void PutSegment(byte[] buffer)
Expand Down
11 changes: 10 additions & 1 deletion src/FirebirdSql.Data.FirebirdClient/Common/BlobStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ public override long Position
set => Seek(value, SeekOrigin.Begin);
}

public override long Length => _blobHandle.GetLength();
public override long Length
{
get
{
if (!_blobHandle.IsOpen)
_blobHandle.Open();

return _blobHandle.GetLength();
}
}

public override void Flush()
{
Expand Down

0 comments on commit f8b8049

Please sign in to comment.