Malfunction in parametrized query

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Malfunction in parametrized query

Post by radub » Sun 09 Mar 2014 12:34

Hello,

PgDac 4.2.6, Delphi 7, Win 7 x64.
I have a very strange situation.
In a form with PgConnection, Provider, PgQuery and a ClientDataset, with a parametrized query.
Below is the source code:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
  PgConnection1.Connected:=true;
  with ClientDataset1 do begin
    if Active then Close;
    CommandText:=
'      select 5 where :a >0'+#13#10+
'      union all'+#13#10+
'      select 590 where :a >0 and :b <0 ';
    for i:=0 to Params.Count-1 do begin
      Params[i].ParamType:=ptInput;
      Params[i].DataType:=ftInteger;
      if Params[i].Name='a' then Params[i].Value:=1;
      if Params[i].Name='b' then Params[i].Value:=-1;
    end;
    Open;
  end;
end;
Obviously, the result should be 2 rows the first with 5 and the 2nd with 590, but is only the first row, with 5.
More odd, if either of parameter is eliminated or the where clause in the 2nd select is changed like ' :b <5' and the value of b is set to 2 or is change like ' :b >0' (!!!), it'll show the correct result.

I need a solution, because this situation appears in a report with a huge and complex query in production.

Thank you,
Radu B.

PS
The culprit is the number of parameters, which has to be equal in all the select statement of the union.
A temporary workaround would be placing the second parameter in the first select.
Unfortunately, in my case isn't functioning because in the first select I have a bunch of parameters which appears in the select list and they have to be paired with the subsequent selects.

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

Re: Malfunction in parametrized query

Post by AlexP » Tue 11 Mar 2014 10:31

Hello,

We have already fixed the problem. In the next PgDAC version, the TPgQuery.Options.DistinctParams option will be added, and setting it to False will allow to support such queries in ClientDataset

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Tue 11 Mar 2014 11:06

Can I get the modifications?
It's urgent, because a lot of reports aren't working in production.

Thank you,
Radu B.

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

Re: Malfunction in parametrized query

Post by AlexP » Wed 12 Mar 2014 15:49

Please send us the license number and an e-mail address where I can send you the fixed version to alexp*devart*com, also specify the used IDE

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Thu 13 Mar 2014 18:39

Hello,

I've sent via email the information you asked for, but I received no answer.
Did the email arrived?

Thank you,
Radu B.

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

Re: Malfunction in parametrized query

Post by AlexP » Fri 14 Mar 2014 10:02

I've sent you the fixed STD version.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Fri 14 Mar 2014 11:57

It seems that something isn't working well.
After installation completed, Delphi reports some errors and didn't load the PgDac components.

The error is:

The procedure entry point @Craccess@TCRRecordSet@CheckedFetched$qqrpvp18Memdata@TFieldDesc could not be located in the dynamic library dac70.bpl.

I wait for the correct module.

Thank you,
Radu B.

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

Re: Malfunction in parametrized query

Post by AlexP » Fri 14 Mar 2014 14:08

Please make sure you have no other products installed, and that you have fully removed the previous PgDAC version.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Fri 14 Mar 2014 16:01

Of course I have!
ODAC 9.2 and SDAC 6.9, latest versions.

And sure I don't want to upgrade those, because the last time when I did it, all the implementations with SDAC/ODAC experienced more or less serious problems in productions.

So, please send me a working kit which is compatible with the other DACs.

We have all 3 platforms installed, Oracle, MsSQL and PostreSQL and is more than 3 months since I cannot update all the implementations in production.

Thank you for your understanding,
Radu B.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Mon 17 Mar 2014 22:12

...still no kit.

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

Re: Malfunction in parametrized query

Post by AlexP » Wed 19 Mar 2014 13:23

Our products use the same common engine, and since this behavior fixing changes were made at the common level as well, you have to update versions of all the used products

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Wed 19 Mar 2014 13:46

Ok.
I wait for the SDAC/ODAC kits.
I am on hold.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Thu 20 Mar 2014 08:37

Hello,

When can I receive the updated SDAC/ODAC?
I want to emphasize that I am still in the position to not be able to deploy the PostgreSQL business logic server and therefore I have some very upset clients.

Please make it as soon as you can.

Thank you,
Radu B.

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

Re: Malfunction in parametrized query

Post by AlexP » Tue 25 Mar 2014 08:11

I have sent you the fixed versions, please check your e-mail.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Malfunction in parametrized query

Post by radub » Wed 09 Apr 2014 05:49

Thank you,

Case closed.

Post Reply