RTC Forums
May 04, 2024, 02:40:20 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Clone TrtcDataSet or TRtcMemDataSet from TQuery without data  (Read 3656 times)
Theprasit
RTC License++
*****
Posts: 42


« 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,



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


« Reply #1 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
Logged
Theprasit
RTC License++
*****
Posts: 42


« Reply #2 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,
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: July 04, 2013, 09:20:09 PM »

Yes, this is by design.
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.024 seconds with 17 queries.