Icon View Incident Report

Serious Serious
Reported By: Rick Wheeler
Reported On: 2/25/2009
For: Version 2.02 Build 8
# 2934 Populating BLOB Parameters via a Stream in Delphi 2007 Unicode Causes Incorrect Data Population

When saving a BLOB field via a parameterised query and using TMemoryStream (the files are jpg images), the stream size is correct to the file size, however the database table is storing double the information. Initially, I thought there must have been something wrong with my application logic, however I have since created a standalone test app and getting the same results

procedure TForm1.Button2Click(Sender: TObject);
var
  TempStream: TMemoryStream;
begin
  TempStream := TMemoryStream.Create;
  try
    Image1.Picture.Graphic.SaveToStream(TempStream);
    EDBQuery1.SQL.Clear;
    EDBQuery1.SQL.Add('INSERT INTO images (image) VALUES (:image)');
    EDBQuery1.Prepare;
    EDBQuery1.ParamByName('image').LoadFromStream(TempStream, ftBlob);
    EDBQuery1.ExecSQL;

    ShowMessage(Format('Saved image with %d bytes', [TempStream.Size]));

    EDBTable1.Refresh;

  finally
    FreeAndNil(TempStream);
  end;

end;



Comments Comments
The issue was with Delphi 2007 and the Unicode version of ElevateDB. BLOB parameter data is stored as a string in Delphi 2007, and the proper adjustments to account for Unicode strings was not made in the engine. This is not an issue in Delphi 2009 due to the fact that it uses byte arrays for BLOB parameter data, and not strings.


Resolution Resolution
Fixed Problem on 2/28/2009 in version 2.02 build 9


Products Affected Products Affected
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image