Param loaded from stream raises an EVariantBadIndexError

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
a.alekizoglou
Posts: 32
Joined: Fri 22 Sep 2006 08:32

Param loaded from stream raises an EVariantBadIndexError

Post by a.alekizoglou » Tue 15 Oct 2013 16:39

I have a problem with latest UniDAC.

I load a parameter from a stream file with

Code: Select all

fMemStream.Position := 0;
MyQuery.Params[i].LoadFromStream(fMemStream, ftBlob);
fMemStream.Clear;
When I run MyQuery.Execute I get an EVariantBadIndexError. The problem is in the procedure TCustomDASQL.AssignParamValue(ParamDesc: TParamDesc; Param: TDAParam).

In fact the Param.GetNativeParamObject does not get propagated immediately when the parameter is some KB. If i put a breakpoint and wait for the hint to come on the IDE for the Param.GetNativeParamObject, then the whole execution works.

Does this have to do with LoadFromStream(fMemStream, ftBlob)?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Param loaded from stream raises an EVariantBadIndexError

Post by AlexP » Wed 16 Oct 2013 08:33

Hello,

Please specify the name of the DB you are using, also send a small sample reproducing the problem to alexp*devart*com (including the script for creating the table)

a.alekizoglou
Posts: 32
Joined: Fri 22 Sep 2006 08:32

Re: Param loaded from stream raises an EVariantBadIndexError

Post by a.alekizoglou » Fri 18 Oct 2013 10:37

AlexP thanks,

I found the problem is related to Delphi XE3. I have to check the blob for blank and set it to null like

Code: Select all

          if fMemStream.Size = 0 then
            Params[i].Value := null
          else
            Params[i].LoadFromStream(fMemStream, ftBlob);

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Param loaded from stream raises an EVariantBadIndexError

Post by AlexP » Mon 21 Oct 2013 07:12

Hello,

Glad to see that you solved the problem. If you have any other questions, feel free to contact us

Post Reply