problem with Options.CompressBlobMode

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

problem with Options.CompressBlobMode

Post by tonisanta » Mon 04 Apr 2016 04:15

Hi,
I upgraded SDAC from version 6 to last version 7. Now when reading blob-data through a TMSQuery with Options.CompressBlobMode set to cbNone where the stored data has been written with CompressBlobMode set to cbServer, accessing the data (ex. SaveToFile ..) an exception is raized. With previous version 6 this worked just fine without exception.
best regards
Toni Santa
SABE SOFT

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Re: problem with Options.CompressBlobMode

Post by tonisanta » Tue 05 Apr 2016 06:41

Hi,
could be, my request was not very clear. Below a few lines of code to reproduce the actually behavior with compressed blobs. With last version 7 writing a blobfield with CompressBlobMode set to cbServer and than reading it with property set to cbNone, the data is not uncompressed. Doing the same with previous version 6 of SDAC the returned blob-stream was uncompressed.
So in the below example the resulting newfile.pdf is not a valid pdf since it contains the compressed stream.
best regards
Toni


Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  MSConnection1.Connect;
  try
    MSConnection1.ExecSQL('create table test (ablob image)');
    MSQuery1.SQL.Text := 'select * from test';
    MSQuery1.Options.CompressBlobMode := cbServer;
    MSQuery1.Active := true;
    MSQuery1.Append;
    TBlobField( MSQuery1.FieldByName('ablob')).LoadFromFile('c:\temp\testfile.pdf');
    MSQuery1.Post;
    MSQuery1.Active := false;
    MSQuery1.Options.CompressBlobMode := cbNone;
    MSQuery1.Active := true;
    TBlobField( MSQuery1.FieldByName('ablob')).SaveToFile('c:\temp\newfile.pdf');
    MSQuery1.Active := false;
  finally
    MSConnection1.ExecSQL('drop table test');
  end;


end;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: problem with Options.CompressBlobMode

Post by AlexP » Mon 11 Apr 2016 12:03

Hello,

Thank you for the sample. We have reproduce the issue and will investigate the reasons for such behavior.

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Re: problem with Options.CompressBlobMode

Post by tonisanta » Thu 28 Apr 2016 07:39

Hi,
will new update 7.3.11 fix this issue?
regards, Toni

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: problem with Options.CompressBlobMode

Post by AlexP » Fri 29 Apr 2016 12:10

We've investigated this behavior, and found that, in earlier versions, even when CompressBlobMode = cbServer, the data were not compressed, so they could be read in any mode. Now the behavior is changed, the data are compressed correctly, so the data should be read from the server in the same mode as they were recorded.

Post Reply