Saving a Memo as Blob using an SQL statement?

Saving a Memo as Blob using an SQL statement?

Postby sjordi » Mon 14 Nov 2005 16:49

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.
sjordi
 
Posts: 7
Joined: Wed 22 Dec 2004 14:54
Location: Prangins, Switzerland

Postby Ikar » Tue 15 Nov 2005 09:22

Please see Images and Text examples in Demo folder.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby sjordi » Tue 15 Nov 2005 09:55

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?
sjordi
 
Posts: 7
Joined: Wed 22 Dec 2004 14:54
Location: Prangins, Switzerland

Postby Ikar » Thu 17 Nov 2005 10:22

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.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components