Page 1 of 1

BlobStream and codepage problem

Posted: 07.12.2007, 18:53
by piper62
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;
--------------------------------------------------------------------------------

Posted: 07.12.2007, 20:46
by piper62
update:
-FileStream.Size is not the problem. same size independent from codepage setting.

at the moment I make a workaround by clearing the properties on the ZConnection, then writing the blob field and resetting it after the commit.

I don't like this solution but at the moment it works.

has anybody an explanation why it doesn't work with utf8 ?

Regards,
Tibor