limelect 48 Posted August 21, 2021 (edited) I have an RTE file which at the end has 3 bytes 02 00 00 Using FDTable with SQLite FDConnection1.ExecSQL('CREATE TABLE IF NOT EXISTS Projects (MyDateTime DateTime,ProjectName TEXT,ProjectrealName TEXT,Category TEXT NULL,Description TEXT NULL,FilesIndex INTEGER)'); Description TEXT NULL =TEXT First, try ProjectsFDTable.FieldByName(',Description').AsString := MY RTE TEXT ProjectsFDTable.Post; ProjectsFDTable.Refresh; Last 3 bytes get deleted !!! Can I use it as a string????????? Second try as a BLOB Description BLOB NULL =BLOB var BlobField:TBlobField; Stream : TStream ; Stream := TStream.Create; <<<<<<<<< I do not free the stream BlobField := ProjectsFDTable.FieldByName('Description') as TBlobField; Stream := ProjectsFDTable.CreateBlobStream(BlobField, bmWrite); xxxx.SaveToStream(Stream); ProjectsFDTable.Post; ProjectsFDTable.Refresh; After Refresh I can see the stream has changed to the data size as needed. BUT NO DATA IN Description field !!!!! closing the application and looking at the database no description data. I did not manipulate the field let Delphi do the work Edited August 21, 2021 by limelect Share this post Link to post
limelect 48 Posted August 23, 2021 Thank you everybody for your kind help. Can someone open a site, not for novices? Even professionals need sometime help Share this post Link to post
Lars Fosdal 1792 Posted August 23, 2021 Even professionals can't really do much without actual source code. Can you reproduce the problem in a self contained compilable example? Share this post Link to post
limelect 48 Posted August 23, 2021 @Lars Fosdal Thanks. All the source is in the question. I thought I was very clear with the problem. In any case, it took me a while but I fixed it. The answer is xxxx.SaveToStream(S); TBlobField(ProjectsFDTable.FieldByName('Description')).LoadFromStream(S); Thanks in any case Share this post Link to post
Lars Fosdal 1792 Posted August 23, 2021 AFAIK, the Text field in SQLite has no length limit. Why use a BLOb? Share this post Link to post
limelect 48 Posted August 23, 2021 @Lars Fosdal You did not read carefully the problem !!! since RTE file which at the end has 3 bytes 02 00 00 The database truncate !!! those bytes when using string You have to use a blob. You can reload the data a string which from which I use it as a stream s := ProjectsFDTable.FieldByName('Description').AsString; St := TStringStream.Create(S); It all comes to this component >>>> AdvRichEditor Share this post Link to post
Lars Fosdal 1792 Posted August 23, 2021 Why are you extracting the blob with AsString and not AsBlob? Share this post Link to post
limelect 48 Posted August 23, 2021 (edited) Do not know why. It was easier on my head. No reason to be perfect. Looking at my source ProjectsFDTable.FieldByName('Description').AsString; has NO BLOB D10.2.3 Edited August 23, 2021 by limelect Share this post Link to post