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.
Code: Select all
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;
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)
Best regards