Saving binary data to a blobfiled
Posted: 24.08.2014, 08:27
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;
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;