Page 1 of 1

Saving a Memo as Blob using an SQL statement?

Posted: Mon 14 Nov 2005 16:49
by sjordi
Hi,
I have several formatted texts in my application. They are WPTools objects (mainly RTF formatted TMemo). i save the to my database using TTables and it works fine.
Now I'm passing everything under SQL and will fully get rid off all the TTables.

Is there any specific steps I should know of before opening or saving BLOB content?

The column name is "RequestText".
Is a SELECT * FROM myTable ;
then connect my Memo field to the RequestText column enough to read it?

Then, would letting the user typing in new text and then just ApplyUpdates() and Commit() if the user clicks my OK button be enough to save the entire TMemo content into the RequestText BLOB variable?

Or should I take another approach?
The BLOB may be anything typed in by the user, as well as a file attached like a PDF, a DOC or an XLS file.

Thanks for any help.

Posted: Tue 15 Nov 2005 09:22
by Ikar
Please see Images and Text examples in Demo folder.

Posted: Tue 15 Nov 2005 09:55
by sjordi
I'm not saving anything to file or loading from file.
I just have people type in text, saved to the BLOB, retrieved to the BLOB.
No files at all are involved in the process.

How do I post to the BLOB field?
Loading seems ok but posting doesn't work.
Should I LoadFromStream and SaveToStream?

Posted: Thu 17 Nov 2005 10:22
by Ikar
Use something like this

Code: Select all

DataSet.Edit;
DataSet.Fields[].AsString := '...';
DataSet.Post;
Note: working with BLOB fields does not differ much from, for example, working with string fields.