You are not logged in.
Pages: 1
I need save and restore some file from database.
This the code:
TSQLDocuments = class(TSQLRecord)
private
...
fFilename: RawUTF8;
fDocument: TSQLRawBlob;
fSize: RawUTF8;
published
...
property Filename: RawUTF8 read fFilename write fFilename;
property Document: TSQLRawBlob read fDocument write fDocument;
property Size: RawUTF8 read fSize write fSize;
end;
To save a file I use "StringFromFile" to convert it in RawByteString then I use UpdateBlob.
To restore I use "FileFromString" to extract file.
For my experience this way work only same type of file. For example I can save/restore TXT and DXF files but I cannot use it with PDF or JPG files, with PDF or JPG the restore file have 0 byte of size. I think these file are not save into database.
Is there error on my code?
NOTE. I have also try to use fDocument: RawUTF8;
regards
Last edited by array81 (2014-03-29 14:57:26)
Offline
property Document: TSQLRawBlob sounds right to me.
This is how the main SynFile demo works... with no problem.
I suspect the problem is how you use it.
Remember that BLOB fields are not transmitted by default, unless you set ForceBlobTransfert property, or explicitly call UpdateBlobFields().
Offline
The problem is that I use the same function and this work only for some file...
Offline
I use TSQLRawBlob so save/restore pdf file and .fr3 file (report) using explicit call to updateBlobField without problem.
Which kind of file cause the problem?i can test in my application.
Offline
Pages: 1