Title: Record to DB Field Post by: ISIGest 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"...:( Title: Re: Record to DB Field Post by: D.Tkalcec (RTC) 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 |