BlobStream and codepage problem
Posted: 07.12.2007, 18:53
Hello,
I have a problem with a BlobSteream.
Environment is: Debian Linux (Etch), FPC 2.0.4, Lazarus 0.9.20 and ZeosLib 6.6.1 (stable).
The purpose is to store files in a blob field a table. The code below worked perfectly with any type of files. Also the size of the files was no problem. -If we pay attention to the MySQL settings.
We changed the ZConnection properties to "codepage=utf8" to solve our codepage problems.
But now I have the problem that the writing of the blobs to the database generates buggy files.
The read out is no problem. There the codepage doesn't effect the files.
Also the filesize is different, I get smaller files if I switch "codepage=utf8" on.
Is the FileStream.Size the problem?
Help appreciated!
Regards,
Tibor
--------------------------------------------------------------------------------
ZQuery1.Append;
BlobStream := ZQuery1.CreateBlobStream(ZQuery1.FieldByName('image'), bmWrite);
try
FileStream := TFileStream.Create(Opendialog1.FileName, fmOpenRead);
try
BlobStream.CopyFrom(FileStream, FileStream.Size);
finally
FileStream.Free;
end;
finally
BlobStream.Free;
end;
--------------------------------------------------------------------------------
I have a problem with a BlobSteream.
Environment is: Debian Linux (Etch), FPC 2.0.4, Lazarus 0.9.20 and ZeosLib 6.6.1 (stable).
The purpose is to store files in a blob field a table. The code below worked perfectly with any type of files. Also the size of the files was no problem. -If we pay attention to the MySQL settings.
We changed the ZConnection properties to "codepage=utf8" to solve our codepage problems.
But now I have the problem that the writing of the blobs to the database generates buggy files.
The read out is no problem. There the codepage doesn't effect the files.
Also the filesize is different, I get smaller files if I switch "codepage=utf8" on.
Is the FileStream.Size the problem?
Help appreciated!
Regards,
Tibor
--------------------------------------------------------------------------------
ZQuery1.Append;
BlobStream := ZQuery1.CreateBlobStream(ZQuery1.FieldByName('image'), bmWrite);
try
FileStream := TFileStream.Create(Opendialog1.FileName, fmOpenRead);
try
BlobStream.CopyFrom(FileStream, FileStream.Size);
finally
FileStream.Free;
end;
finally
BlobStream.Free;
end;
--------------------------------------------------------------------------------