Menu

#184 Access violation Updating a Blob

Unknown
closed
nobody
None
2017-02-22
2017-02-02
Tintinux
No

Using ZeosLib 7.2.1-rc with Lazarus 1.6.0, I have an access violation when I execute the UPDATE ZQuery (see the code below). Image is a TImage remaining empty. The field Test is a Blob. The error exists also with a non empty image.

There is no error with ZeosLib 7.1.4-stable.

I have attached a simple Lazarus program reproducing the issue, with a screen copy of the error message.

I don't know if it happens also with Delphi, but my code should be compatible after changing the extensions, (rename lpr in dpr, lfm in dfm).

I have only Delphi 2007 and it would require me some time to reinstall it... and maybe it is not very useful to try with such an old version.

Best regards

procedure PictureToParam(const aPicture: TPicture; const aParam: TParam);

var
  Stream: TStream;

begin
  Stream := TMemoryStream.Create;
  try
    aPicture.PixMap.SaveToStream(Stream);
    Stream.Position := 0;
    aParam.LoadFromStream(Stream, ftBlob);
  finally
    Stream.Free;
  end;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
  ZQuery.Sql.Text := 'UPDATE Testzeos SET Test := :Test ;' ;
  PictureToParam(Image.Picture, ZQuery.Params[0]);
  ZQuery.ExecSql;
  showmessage ('no error !');
end;   
1 Attachments

Discussion

  • Tintinux

    Tintinux - 2017-02-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Using ZeosLib 7.2.1-rc with Lazarus 1.6, I have an access violation when I execute the UPDATE Query in the code below. Image is a TImage remaining empty. The field Test is a Blob.
    +Using ZeosLib 7.2.1-rc **with Lazarus 1.6.0**, I have an access violation when I execute the UPDATE ZQuery (see the code below). Image is a TImage remaining empty. The field Test is a Blob.
    
     There is no error with ZeosLib 7.1.4-stable.
    
    @@ -7,8 +7,6 @@
     I don't know if it happens also with Delphi, but my code should be compatible after changing the extensions, (rename lpr in dpr, lfm in dfm)
    
     Best regards
    -
    -PS : The code in the attachment is :
    
     ~~~
     procedure PictureToParam(const aPicture: TPicture; const aParam: TParam);
    
     
  • Tintinux

    Tintinux - 2017-02-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,7 +4,9 @@
    
     I have attached a simple Lazarus program reproducing the issue, with a screen copy of the error message.
    
    -I don't know if it happens also with Delphi, but my code should be compatible after changing the extensions, (rename lpr in dpr, lfm in dfm)
    +I don't know if it happens also with Delphi, but my code should be compatible after changing the extensions, (rename lpr in dpr, lfm in dfm).
    +
    +I have only Delphi 2007 and it would require me some time to reinstall it... and maybe it is not very useful to try with such an old version.
    
     Best regards
    
     
  • Tintinux

    Tintinux - 2017-02-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Using ZeosLib 7.2.1-rc **with Lazarus 1.6.0**, I have an access violation when I execute the UPDATE ZQuery (see the code below). Image is a TImage remaining empty. The field Test is a Blob.
    +Using ZeosLib 7.2.1-rc **with Lazarus 1.6.0**, I have an access violation when I execute the UPDATE ZQuery (see the code below). Image is a TImage remaining empty. The field Test is a Blob. The error exists also with a non empty image.
    
     There is no error with ZeosLib 7.1.4-stable.
    
     
  • EgonHugeist

    EgonHugeist - 2017-02-20

    Hi Tintinux,

    hope i got it. Please update from SVN.

    Commit done: 3956

    Please close if OK.

     

    Last edit: EgonHugeist 2017-02-20
  • Tintinux

    Tintinux - 2017-02-22

    Hi
    Yes it works now with Lazarus 1.6.2.
    Thanks.

     
  • Tintinux

    Tintinux - 2017-02-22
    • status: open --> closed
     

Log in to post a comment.