RTC Forums
May 16, 2024, 08:27:28 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: TRtcDataset and Blobs  (Read 3540 times)
HelgeLange
RTC Expired
*
Posts: 100


« on: February 12, 2016, 06:58:25 PM »

Hi Danijel,

I'm doing some tests here syncronizing tables through RTC.
1 Table uses blobs with binary data. For test purposes I load them into a memorytable and when I save this one to file I see that the blob data is inside (so basically I could send this stream), but when I use RTC to send the data, the blobs go missing.

I use this code to copy the data on my serverside
Code:
DelphiDataSetToRtc(VT, _vtData);

Any plans to include blobs ? or do I do something "wrong" ?

Thanks, Helge
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 12, 2016, 07:44:24 PM »

Actually, BLOB field should already work with the DelphiDataSetToRtc function (check the "Fish Facts" DB Demos in the "SDKDemos_VCL_DBA" and "SDKDemos_FMX_DBA" Project Groups), but ... different (especially 3rd-party) TDataSet implementations could handle and/or store BLOB fields differently than expected by that function, so you will have to write your own version of it, to make sure that all data is copied from one side to the other correctly.

In short, RTC does NOT work with BLOB fields, nor does it work with TDataSet components. It has it's own TRtcDataSet class, which supports a number of data types for storage and remote transfer, including TRtcByteStream (a TMemoryStream descendant) and RtcByteArray (array of bytes), both of which can be used for storing and sending binary data (like BLOB fields, for example). But, it is your own responsibility to get your data in and out of a TRtcDataSet (or any other RTC Value Object - for that matter).

So ... in case the DelphiDataSetToRtc function does NOT work with all the DataSet field types you are using, then you should make your own version of that function. Just copy the original implementation of that function (along with any other functions required) into your own unit, rename them to avoid naming conflicts with the original functions and modify them to work directly with the DataSet components you are using.

If you also need to move that data back from a TRtcDataSet into a TDataSet component (for example, after having received it remotely) and you have been using the RtcDataSetFieldsToDelphi and RtcDataSetRowsToDelphi functions from the rtcDB unit (or some other functions from that unit), you should also make your own versions of those functions and modify them to copy your data back - correctly.

Best Regards,
Danijel Tkalcec
Logged
HelgeLange
RTC Expired
*
Posts: 100


« Reply #2 on: February 12, 2016, 07:55:44 PM »

I made it work with string the whole dataset not in the TRtcDataset, but in a stream and send this stream through RTC as a byte stream to the client, there I load it from the ByteStream to the same component and insert/update everything with a batchmove. Works like a charm.

Normally I use DelphiDataSetToRtc function and it works just fine.

Thanks, I will check out the code to see, why it doesn't work out of the box with UniDAC TVirtualTable

Helge
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.025 seconds with 17 queries.