I am using C++ Builder 2009 and have problems saving RichViewEdit into the BLOB field into local paradox table.
Here is the relevant part of my code:
DataModule1->Query1->SQL->Add("INSERT INTO rvftable (id,rvfcontent) ");
DataModule1->Query1->SQL->Add(" VALUES (:id,:rvfcontent)");
DataModule1->Query1->ParamByName("id")->AsInteger = pacid;
TMemoryStream* stream = (new TMemoryStream);
RichViewEdit1->SaveRVFToStream(Stream, false);
DataModule1->Query1->Params->ParamByName("rvfconten")->SetBlobData(stream->Memory,stream->Size);
DataModule1->Query1->ExecSQL();
DataModule1->Query1->Close();
delete stream;
The result in the blob table shows only set of question marks: "????????????????????????"
When I save the stream to the file it shows something different.
Thus I have a question: How to properly save (and read) content of RichEditView using BDE TQuery (not TTable) component ?
Saving RichViewEdit content in BLOB field using BDE
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I have found the description of TParam.LoadFromStream problem in D2009:
"The problem is in db.pas unit. In older non unicode versions of delphi
LoadFromStream use string variable to read data from stream and pass them to param value. Now use TBytes to read data. If you changed TBytes with AnsiString or if you pass data to param value using StringOf(TBytes variable) it works Ok."
but it seems to me that StringOf cannot work with not string data like in RVF format. Thus how to store RVF data in blobs ?
"The problem is in db.pas unit. In older non unicode versions of delphi
LoadFromStream use string variable to read data from stream and pass them to param value. Now use TBytes to read data. If you changed TBytes with AnsiString or if you pass data to param value using StringOf(TBytes variable) it works Ok."
but it seems to me that StringOf cannot work with not string data like in RVF format. Thus how to store RVF data in blobs ?
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If, because of this bug, TParam cannot be used to assign binary data (like jpeg or rvf), all that I can suggest is using RTF instead and assign it as string.
Unfortunately, some document attributes are lost when saving to RTF.
(there is an option for saving text RVF, but it will not work correctly if the document will be converted to Unicode and back, because this text-mode RVF can contain characters from different code pages)
Unfortunately, some document attributes are lost when saving to RTF.
(there is an option for saving text RVF, but it will not work correctly if the document will be converted to Unicode and back, because this text-mode RVF can contain characters from different code pages)