TUniParam::LoadFromStream doesn't work properly

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
gb
Posts: 42
Joined: Wed 05 Mar 2008 12:32

TUniParam::LoadFromStream doesn't work properly

Post by gb » Fri 19 Nov 2010 17:14

Hi!

TuniParam is descendent from Dbaccess::TDAParam,
which is descendent from Db::TParam.

Most of the methods/properties of a TuniParam works
as expected when interpreted as it's ancestor
Db::TParam. However, LoadFromStream does not. It
doesn't give any error on itself, but later on when
callling ExecSQL on a TUniQuery, it'll give an access
violation reading address 0x000000.

Suming up:
TUniQuery *qr = ...;
TParam *Param = qr->ParamByName("SomeParam");

std::auto_ptrStream(new TStringStream("dummy blob"));
Stream->Position = 0;

Param->LoadFromStream(S.get(), ftOraBlob);

qr->ExecSQL(); // AV!!!

Any hints?

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

Post by AlexP » Mon 22 Nov 2010 08:30

Hello,

I can not reproduce the problem.
Please specify the following information:
- the exact version of UniDAC;
- the name and exact version of your IDE.
Also please send a complete small sample to alexp*devart*com to demonstrate the problem.

gb
Posts: 42
Joined: Wed 05 Mar 2008 12:32

Post by gb » Mon 22 Nov 2010 16:45

Thank you for taking a look on it.

Unfortunatly my time slot to test UniDac has been reasigned to a later date. I'll be back into this in the next couple of months, hopefully.

iPath
Posts: 1
Joined: Wed 03 Oct 2012 20:03

Re: TUniParam::LoadFromStream doesn't work properly

Post by iPath » Wed 03 Oct 2012 20:13

I've came across this problem recently. It's because of Param is declared to be TParam.
The AV occurs in DBAccess/TDAParam.GetIsNull on the line [Result := TBlob(FParamObject).Size = 0]

FparamObject is NIL and the code does not test for NIL :)

If you declare Param to be TDAParam - it works :)

I was using tUniQuery.params.AddParameter - it returns TParam, but not TDAParam!

I wonder if this is normal behavior or a bug?

(Using UniDac 4.5.9)

Regards,
Petar

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

Re: TUniParam::LoadFromStream doesn't work properly

Post by AlexP » Mon 08 Oct 2012 12:37

Hello,

For the time being, to avoid AV, you should use the TDAParam class instead of TParam, or explicitly specify the parameter data type. We will investigate the possibility to modify this behaviour in one of the next versions.

Post Reply