RTC Forums
November 24, 2024, 05:02:42 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Record to DB Field  (Read 4174 times)
ISIGest
RTC Expired
*
Posts: 121


« on: February 13, 2015, 12:28:44 PM »

Hi Danijel, could you tell me if there is a function to convert a value type to to DB Field type?

I see the "RTC_FIELD2DB_TYPE" function but it accept a "TRtcFieldTypes" param and not "TRtcValueTypes"...Sad
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 13, 2015, 12:44:11 PM »

There is no direct co-relation between a RTC Value Type and a DB Field Type, because these are two completely different things. Only RTC Field types have a direct 1:1 relation to Delphi DB Field types. TRtcDataSet class has a FieldType property, which accepts a TRtcFieldType value to specify a DB Field Type and that is what you should use to set a DB Field type when using a TRtcDataSet to send DB-related data. If you are looking for examples on moving data between a TRtcDataSet and a TDataSet, check the "rtcDB.pas" unit and you will find these functions:

// Copy data from a Delphi TDataSet into a TRtcDataSet (used for transport)
procedure DelphiDataSetToRtc(DelphiDS:TDataSet; rtcDS:TRtcDataSet;
    ClearFieldDefs:boolean=True; OnlyDataFields:boolean=True);

// Copy data from a Delphi TDataSet into a TRtcArray of TRtcRecords (used for transport)
procedure DelphiDataSetToRtcArray(DelphiDS:TDataSet;
    rtcArr:TRtcArray; OnlyDataFields:boolean=False);

// Copy field definition from a TRtcDataSet (used for transport ) to a Delphi TDataSet
procedure RtcDataSetFieldsToDelphi(rtcDS:TRtcDataSet; DelphiDS:TDataSet);

// Copy data rows from a TRtcDataSet (used for transport) to a Delphi TDataSet
procedure RtcDataSetRowsToDelphi(rtcDS:TRtcDataSet; DelphiDS:TDataSet);

Copy the implementation of these functions to your own unit and use them as a starting point for whatever you need to do.

Best Regards,
Danijel Tkalcec
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 16 queries.