Title: AV with Unsupported Variant Type Post by: zsleo on November 20, 2012, 07:49:56 AM Delphi XE; MS SQL; RTC SDK v4.49
I have an MS SQL DB with ADO Connector and doing RTC Dataset "select". At the Delphi level the data type being retrieved is "Variant array of Byte". In rtcDB.pas I have placed the a "try...except...end" around line "rtcDS.Value[fldname]:=field.Value;" in the procedure "DelphiDataSetToRtc" as a short term fix. Question: is there a fix for the problem? TIA Zane Title: Re: AV with Unsupported Variant Type Post by: D.Tkalcec (RTC) on November 20, 2012, 08:44:28 AM Hi Zane.
Can you pin-point where exactly the AV is happening? If it is reproducible, you should be able to get a Call Stack while running the Client in Delphi debug mode. Best Regards, Danijel Tkalcec Title: Re: AV with Unsupported Variant Type Post by: zsleo on November 20, 2012, 09:28:48 AM Danijel
The MS SQL field is " [InitVector] varbinary(100) NULL," The AV is server side in rtcDB.pas where I have marked it with "<<=====" Code: procedure DelphiDataSetToRtc(DelphiDS:TDataSet; rtcDS:TRtcDataSet; ClearFieldDefs:boolean=True); Regards Zane Title: Re: AV with Unsupported Variant Type Post by: D.Tkalcec (RTC) on November 20, 2012, 10:30:30 AM Hi Zane,
Are you using Debug DCUs? The line you are pointing out might be where the AV is getting out, but unless it is a result of a bug in Delphi itself (compiler or the DB.pas unit), it would be raised somewhere inside the "rtcInfo.pas" unit and NOT inside the "rtcDB.pas" unit, because the rtcDS.Value[] assignment is actually a method call into the "rtcInfo.pas" unit, which is receiving the Variant result of the "field.Value" property as a parameter. Anyway ... there is no automatic conversion from a Variant byte array type to a RTC Value object, so the solution to your problem is to make your own copy of the "DelphiDataSetToRTC" function and write the code needed to make the conversion and assign it to the RTC field by using "asByteArray" (in RTC SDK v6.x), "asByteStream" or some other natively supported type by the RTC SDK. The assignment to the Value[] property is only a short-cut, which works for simple types but not for complex types like byte arrays. Best Regards, Danijel Tkalcec Title: Re: AV with Unsupported Variant Type Post by: zsleo on November 21, 2012, 12:52:24 AM Thanks,
I will extend the interface as you suggest to cater from this data type. Regards Zane |