Title: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data Post by: Theprasit on July 04, 2013, 07:50:44 PM Hi,
I use rtcDB.DelphiDataSetTortc() to clone from TQuery but I need only structure (no data). I'm looking for something like EmptyDataSet or ClearData method. Any advise. Regards, Title: Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data Post by: D.Tkalcec (RTC) on July 04, 2013, 08:18:27 PM The solution is simple. Copy the DelphiDataSetToRtc function from the rtcDB unit to your own unit, give it another name, and then make any changes you want/need (like copying only field structure without data, or adding support for other field types). DelphiDataSetToRtc and RtcDataSetToDelphi functions in the rtcDB unit are only examples. You will need to make your own version of these functions if you want to make full use of all types supported by your Database Engine.
Best Regards, Danijel Tkalcec Title: Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data Post by: Theprasit on July 04, 2013, 08:38:18 PM Sorry, for missing something.
Normally, I need to call SQL like (Select * From MyTable Where 1=2) and clone it as empty table for another transaction processing. I tried DelphiDataSetToRtc but the output is a blank MemDataSet with only one column. Unfortunately, I found the solution like this:- - Call SQL - use DelphiDataSetToRtc(SQL, Result.NewDataSet) - client side: use RtcMemDataSet.asDataSet:= Result.asDataSet; This work as expected. I notice that using RtcMemDataSet.Close or RtcMemDataSet.Active:= False will clear all both Data and Structure. Is this by-design? Best Regards, Title: Re: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data Post by: D.Tkalcec (RTC) on July 04, 2013, 09:20:09 PM Yes, this is by design.
|