Zeoslib 7.1.3 Stable, Delphi XE4, Windows 7
I am trying to save binary data (exe files) into a blob field (longblob) using the following code:
When I execute it I get "MySql server has gone away". It does work on smaller files < 1MB.
Any ideas.
try
Import := TZTable.Create(nil);
Import.Connection := Connection;
Import.TableName := 'Versions';
Import.Open;
Import.Insert;
Import.FieldByName('FileName').AsString := ExtractFileName(FileName);
Import.FieldByName('VersionNo').AsInteger := ExistingVersion.AsInteger;
Import.FieldByName('CRC').AsInteger := CRC;
try
FileStream := TFileStream.Create(FileName, fmOpenRead);
TBlobField(Import.FieldByName('Exe')).LoadFromStream(FileStream);
finally
FileStream.Free;
end;
Import.Post;
Import.Close;
finally
Import.Free;
end;
Saving binary data to a blobfiled
Moderators: gto, cipto_kh, EgonHugeist
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Saving binary data to a blobfiled
Hi,
AFAIR is this related to server-settings. Execute 'SET GLOBAL max_allowed_packet=16*1024*1024;'
And another suggestion:
Add 'preferprepared=True' to the TZDataSet.Properties. This parameter enables the MySQL real-prepared stmt and this can send lob's in chunks.
AFAIR is this related to server-settings. Execute 'SET GLOBAL max_allowed_packet=16*1024*1024;'
And another suggestion:
Add 'preferprepared=True' to the TZDataSet.Properties. This parameter enables the MySQL real-prepared stmt and this can send lob's in chunks.
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Saving binary data to a blobfiled
Hi
Thanks you for the "set global" comment, it fixes the problem perfectly; I have changed the server ini now. I had wondered if it was a setting, I should have thought before I posted.
I will try the "prefer prepared" line.
Thanks for the help.
Peter
Thanks you for the "set global" comment, it fixes the problem perfectly; I have changed the server ini now. I had wondered if it was a setting, I should have thought before I posted.
I will try the "prefer prepared" line.
Thanks for the help.
Peter