PB5 has a new control, the RichTextEdit control. You can use this RTE control to read/update database blob fields for text editing purposes. To do this, you need the PB SELECTBLOB statement to get the value from the database and the UPDATEBLOB statement to store it back to the database again.
First, get the data from a database blob column:
BLOB lbl_Descr Storing RTE data to the database:
INTEGER li_W, li_H
SELECTBLOB blobcolumn FROM tableX INTO :lbl_descr WHERE ....;
/* To past this data into the RTE control do: */
/* Now, because the RTE does not initially autowrap,we must force this. The AutoWrap property of the RTE control must be TRUE. */
li_W = rte_Main.width
li_H = rte_Main.height
/* Finally, set the Modified attribute to FALSE so that the RTE control is ready for use: */
rte_Main.Modified = FALSE
Now, to do the opposite, that is, storing the contents of the RTE control in the database column code the following. First check if it is modified, then check if it has a value because you can't use the UPDATEBLOB function with no data to update:
IF rte_Main.Modified THEN lbl_Descr = blob(rte_Main.CopyRTF(FALSE)) IF IsNull(lbl_Descr) OR trim(string(lbl_Descr)) = '' THEN UPDATE tableX SET blobcolumn = NULL WHERE .... ELSE UPDATEBLOB tableX SET blobcolumn = :lbl_Descr WHERE .... END IF END IF
That's all there is. Note that with 16bit OS, you're limited to 59999 characters because of the conversion done by the String() function. On 32bit OS, you don't have this problem.